Andy Gilbert Posted January 12, 2012 Share Posted January 12, 2012 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 Quote 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 More sharing options...
Josh Posted January 12, 2012 Share Posted January 12, 2012 TFormVector(0,0,1,entity,NULL) returns the direction an entity is facing on the Z axis, which is most commonly the front. Quote 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 More sharing options...
Andy Gilbert Posted January 12, 2012 Author Share Posted January 12, 2012 Thanks josh, that really is simple. I really need to get my head around them commands and how they work. Thanks Andy Quote 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 More sharing options...
Josh Posted January 12, 2012 Share Posted January 12, 2012 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. Quote 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 More sharing options...
Andy Gilbert Posted January 13, 2012 Author Share Posted January 13, 2012 That sounds good, all helps when you can visualise changes as you do them. Thanks Andy Quote 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 More sharing options...
Road Kill Kenny Posted January 13, 2012 Share Posted January 13, 2012 I love the TForm commands. Epicly useful. Quote STS - Scarlet Thread Studios AKA: Engineer Ken Fact: Game Development is hard... very bloody hard.. If you are not prepared to accept that.. Please give up now! Link to comment Share on other sites More sharing options...
Recommended Posts
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.