Jump to content

Facing Direction vector


Andy Gilbert
 Share

Recommended Posts

Hi, ive covered on this before but i never managed to work it out but now coming back to it.

 

It sounds simple but it appears not so (for me anyway), i want to get the "facing direction vector" of a body/model. Im trying to calculate the angle of attack. To do this you need the objects velocity and the objects front direction vector.

 

On the newton forum theres a few ways to it but they get the "facing direction" by getting the "front" of the matrix.

 

dMatrix planeGlobalMatrix;

NewtonBodyGetMatrix (planeBody, (float*)&planeGlobalMatrix);

 

dVector facingUnit = planeGlobalMatrix.m_front; // first vector, = x axis

 

I can easily get an "angle value", z angle of the object gives me a rotation angle, but to do the equation to solve AoA you need to do the dot product of the veloicty vector and facing vector. And getting the rotation value of Z doesnt give me a facing vector.

 

In easier terms i want to find the angle between two vectors, one i have (object velocity) the other (facing vector) i dont.

 

Anyone know how to solve this?

 

Thanks

Andy

The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do.

 

Leadwerks Game-Ready 3D Models:https://sellfy.com/gib3d

Link to comment
Share on other sites

The model editor in Leadwerks3D actually helps a lot with this because as you type in position, rotation, and scale values, you will see the entity matrix values update to match your input.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...