Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.
I have an airplane in world space.
How to represent its orientation?
How to rotate it around its axes?
Iam using directx8.
I have seen many examples where there is a class representing
an 3d object. They also have methods like rotate, but this methods allways apply to world axes! I need it to rotate around its own axes!
If you have some source it would be great!
bye and thanx & please
ivan bolèina
Apply the rotation to the body before you rotate it into world space. E.g. suppose the object''s rotation matrix is R, and you want to rotate it about the x-axis, with a matrix X.
The matrix XR gives the result of taking it''s existing rotaiton and rotating about the x-axis. But the matrix RX rotates it about the x-axis in its frame of reference before rotating it into the world space,
If you want to update its position by rotating it about its own X axis use something like
R = RX
Where X gives the appropriate rotation for the time step between calculations. Using X as a rotation about the x-axis is just an example: this works with any valid rotation matrix.
The mathematics looks identical with quaternions, but with one possible difference. There are two ways of using quaternions, one where the multiplication order is the same as matrices, the other where all multiplications are done the other way round. Which you use depends on the API: there''s no single standard so if you''re not sure just try it both ways to see which works.
Each object you want to rotate keeps a quaternion around that stores it''s current rotation. Quaternions are kinda like vectors for rotations. So you build a q that represents the relative change in rotation, and mutliple the avatar''s current facing quaternion by this, and voila, the resultant q is the facing you want.
For an airplane simutalation you will need something better than D3DMath_QuaternionFromAngles(dr.x, dr.y, dr.z, dr.w, 0.0f, Turn_r, 0.0f); - I use this when they hit the turn left key.
I think you can use Q''s with magnitude to represent torques.
> I think you can use Q''s with magnitude to represent torques.
You should use vectors for torque, angular velocity, angular momentum, etc. They are related by simple vector equations, e.g.
T = dL/dt L = Iw
T = torque, L = angular momentum, w = angular velocity, I = moment of inertia
Angular velocity and the rotation quaterninon are related by the equation
dq/dt = 1/2 w * q
Here w is treated as a quaternion so it can be multiplied by q, but is still a vector quantity. As with most things to do with quaternions the multiplication order depends on the quaterion ordering convention. This equation is used to update the rotation, e.g. using Euler''s method to get
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.