Airplane rotation around its own axes
Started by Aug 14 2001 08:28 PM
,
4 replies to this topic
#1 Members  Reputation: 122
Posted 14 August 2001  08:28 PM
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
#2 Members  Reputation: 351
Posted 14 August 2001  10:00 PM
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 xaxis, with a matrix X.
The matrix XR gives the result of taking it''s existing rotaiton and rotating about the xaxis. But the matrix RX rotates it about the xaxis 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 xaxis 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.
The matrix XR gives the result of taking it''s existing rotaiton and rotating about the xaxis. But the matrix RX rotates it about the xaxis 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 xaxis 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.
#4 Moderators  Reputation: 1648
Posted 16 August 2001  03:07 PM

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.
Magmai Kai Holmlor
 Not For Rent
#5 Members  Reputation: 351
Posted 20 August 2001  03:58 AM
> 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
q = q + 1/2 w * q * time_step
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
q = q + 1/2 w * q * time_step