   Rolling a ball on the floor (please HELP)
  Hi. I have a problem simulating the draft of a ball on having rolled on a floor.The spherical mesh of the ball contains three rotations (x, y, z - i think its euler angles) by means of which its rotation is represented in the world (and therefore the direction at which it mesh points). I need to rotate this one ball on the floor using its speed 'X','Y' in order that it seems that it rolls in the direction towards the one that moves.  My question is: If the sphere has a different rotation from 0,0,0 and therefore its axes do not coincide with the axes of the world, I cannot add Vx to the rotation X because the axis X of the ball already is not the same that the axis X of the world (the same thing with Y). How must I change the values of the 3 angles of local rotation of the sphere in order that it rotates on the axis 'X' or the axis 'Y' of the world?. The floor is the plane represented for X, Y.I have tried everything. I dont know how to obtain the vector of direction of 3 angles to rotate it on the world axis, also i dont know how to build a matrix from 3 angles to be able to rotate it, not how to obtain 3 angles of the matrix rotated of return to place them in my program's sphere. I think im really really clumsy, and im really frustrated with this.Then sorry for my english, and thanks for reading   
  Short answer: Don't represent the ball's orientation using Euler angles. Instead, use a quaternion or 3x3 matrix, and apply local rotations about an axis perpendicular to the ball's direction vector and world up vector.   ;  yeah .. but I have a problem. My chief created a language of script to program applications with his engine, and I am very angered for that he does not leave me using c++ and all its support to programme the game.Now I have to programme all the mathematical functions from 0. I cannot change the fact that the only way of changing the rotation of an object 3D is made using Euler's angles.After searching, I have found the way of transforming Euler's angles into a matrix. Also I have found the way of turning this matrix into Euler's angles again.You believe that what I have to do is:To turn Euler's angles into a matrix, to multiply this matrix by 3 matrixes of rotation for every axis of the world. And to return to turn the matrix result into Euler's angles?¿¿¿¿¿¿1- Euler To matrix1 2- matrix2 = matrix1 * rotMatrixX * rotMatrisY * rotMatrixZ3- matrix2 to Euler??????thanks friend.   ;  I'm not sure what limitations you're dealing with exactly, but if the API only works with Euler angles, you'll probably have to do something like the following:1. Get the orientation in Euler angle form2. Convert to matrix or quaternion3. Apply an appropriate rotation as described previously4. Convert matrix or quaternion back to Euler angles5. Send the Euler angles to the APIThis is somewhat similar to what you described, except that you only need to apply a single axis-angle rotation (the axis can be computed from the direction vector and the world up vector, and the angle can be computed from the ball's speed and circumference).   ;Quote:Original post by Viej0My chief From a spanish speaker to another spanish speaker, did u mean boss? chief is either an indian with a feather hat, a high ranking officer, or if it has "master" before it, a kick*ss supersoldier;  LOL. My english is really bad, then i used a translator. Next time ill use boss :D   ;  well... Now I use the mesh's quaternion rotation directly to rotate it without having to do transformations with Euler's angles. But a problem continues happening.What I do is to obtain the axis of rotation and the angle of rotation to apply on the mesh's quaternion an angle-axis rotated quaternion.Initially it seems to work, I am applying the rotations like it sees in the code of below, but a moment comes that the rotation becomes mad or something and the sphere already does not roll like it should.I do not understand which can be the mistake ..: (Here the code..// Cross product betweend speed(direction) vector of ball, and plane's normal(0,0,1) to get axis rotation vectorvDir  = PointNormalize(speedX,speedY,0.0f);vAxis = PointCross(vDir.x, vDir.y, 0.0f, 0.0f,   0.0f, 1.0f);// Normalize the axis rotation vectorvAxis = PointNormalize(vAxis.x,vAxis.y,vAxis.z);// Len of speed (to give angle of rotation)len   = PointLength(speedX, speedY, 0);angle = len * 0.022f;// This function multiply mesh's rotation quaternion by a quaternion angle-axis rotated (with vAxis and angle)Object_ApplyRotation(this, angle, vAxis.x,vAxis.y,vAxis.z);//The new rotations work during a time.., but many rotations do that the ball rotates of strange forms..!   ;  My problem was:I was trying..QRotResult = QRotActual * QRotAngleAxis; // *** WRONG ***Right expression..QRotResult = QRotAngleAxis * QRotActual; // *** yeeeeah ***   