Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Airplane rotation around its own axes


Old topic!
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.

  • You cannot reply to this topic
4 replies to this topic

#1 ibolcina   Members   -  Reputation: 122

Like
Likes
Like

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

Sponsor:

#2 johnb   Members   -  Reputation: 347

Like
Likes
Like

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 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.

#3 ibolcina   Members   -  Reputation: 122

Like
Likes
Like

Posted 15 August 2001 - 06:30 AM

I feel so damm stupid.

Wouldn''t R=RX just rotate current rotation matrix around X axis in world-space?

I would kill for some code. I suppose I understand matrix(or affine transformations), but this is major headache. Damm!

thanx for help


#4 Shannon Barber   Moderators   -  Reputation: 1383

Like
Likes
Like

Posted 16 August 2001 - 03:07 PM

  
void CAvatar::RotateLeft(float fElapsed_sec)
{
D3DXQUATERNION dr;

float Turn_r = m_fTurnRate_rps * fElapsed_sec;

D3DMath_QuaternionFromAngles(dr.x, dr.y, dr.z, dr.w, 0.0f, Turn_r, 0.0f);
m_qFacing = dr * m_qFacing;
m_bTurned = TRUE;
}


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 johnb   Members   -  Reputation: 347

Like
Likes
Like

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





Old topic!
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.



PARTNERS