   Rotational axis? for movement of ball
  I have a ball on a track and right now the ball moves side to side and I change the rotation based on which key the user has pressed. Problem is when the user presses fwd and left/right the ball doesn't say 45 degrees. So to make the ball look a bit more realistic in movements what am I needing to do to get this ball to rotate correctly when moving 2 directions at once vs. 1(fwd,right, left) Their isn't any backwards...//used to calculate playerDir and is a scalar//used later on with a playerTransformMatrix to determine playerPos.xyzvelocityClamped = velocity;NX::MATH::Clamp<float>(velocityClamped, .5f, 1.0f);if(playerRight)playerDir += velocityClamped * PLAYERDIR_ACCEL_CONSTANT * DIR_CHANGE_RATE;if(playerLeft)playerDir -= velocityClamped * PLAYERDIR_ACCEL_CONSTANT * DIR_CHANGE_RATE;//for the rotation of the ballif(playerRight)rotMatrix.Rotate(angle * velocity, false, false, true);//z axiselse if(playerLeft)rotMatrix.Rotate(-angle * velocity, false, false, true);//z axiselserotMatrix.Rotate(angle * velocity, true, false, false);//x axisrotMatrix is a 4x4 matrixthanks   
  There's not much to go off of from that code, but if I understand  correctly, you're trying to have the combination key-press LEFT + UP create a 45 degree rotation as opposed to a full 90 (or 0) degree rotation. The problem with your code, then, is the if/else if/else sequence. In the event of a LEFT + UP combination, only one of those if blocks is going to be executed; namely, the first one that evaluates to true.Try changing the code to a series of simple ifs. This way, each of the statements that evaluates to true will be executed, not just the first one.   ;  Nah that doesn't work, the ball goes all nuts like you are stretching it out and contracting it...   ;  LOL. So much for listening to me [smile]Out of curiosity, what does your code look like now?   ;  I used thisif(playerRight)rotMatrix.Rotate(angle * velocityClamped * .1f, false, false, true);if(playerLeft)rotMatrix.Rotate(-angle * velocityClamped * .1f, false, false, true);if(playerFwd)rotMatrix.Rotate(angle * velocity * .00025f, true, false, false);;  Can you post your Rotate() function?   ;  Hi jky,I changed my Rotate to sepearate functions but still does the same thing as before. I can only rotate one axis at a time with this rotate function. What I am wondering is do I need to do some kind of rotational velocity or angular velocity? I have no idea I am not looking for realistic simulation here, but would like the ball to spin on the correct axis when the player moves in those directions?Thanks//Rotate a 3D point in Radians not Degreesvoid RotateX(T angle){    T sine   = sin(angle);T cosine = cos(angle);matrix[5]  = cosine;matrix[6]  = sine;matrix[9]  = -sine;matrix[10] = cosine;}//Rotate a 3D point in Radians not Degreesvoid RotateY(T angle){    T sine   = sin(angle);T cosine = cos(angle);   matrix[0]  = cosine;matrix[2]  = -sine;matrix[8]  = sine;matrix[10] = cosine;}//Rotate a 3D point in Radians not Degreesvoid RotateZ(T angle){    T sine   = sin(angle);T cosine = cos(angle);   matrix[0] = cosine;matrix[1] = sine;matrix[4] = -sine;matrix[5] = cosine;};  What are the types of velocity and playerDir?I notice that your rotation functions don't set the matrix to identity before setting the relevant elements. Is this intentional? This means that the results may be incorrect if the matrix is not already identity.   ;  both are scalar floats and I call identity before the rotate in a separate call   ;  Don't you need 3 rotation matrices, one for each axis, then rotMatrix would be the product of those 3 matrices (in the right order) ? Your RotateX/Y/Z functions assume the matrix is identity, so you can't call those functions successively on the same matrix. It overrides part of the last rotation, stretching the ball.   