Find a direction of a object / body?

Started by
2 comments, last by Zakwayda 13 years, 1 month ago
Hi all, my brain is slowly dying as i try over and over again to solve this.

The result i am trynig to end up after all this is the AoA of a wing or plane. but ignoring that im stuck way before i get to that part.

to get the angle of attack i need the angle between the direction an object is moving and the direction an object is facing.

Now getting the objects facing direction is simple as im guessing that is found from the objects local axis.

But how do i get the objects moving direction?

Im using leadwerks engine which has newton game dynamics built in which im using

Included is a quick sketch to what im after.

[attachment=1487:direction.png]

Hope you can help.
Thanks
Andy
Parafly Paragliding Simulator : http://www.parafly-sim.co.uk
Parafly Youtube Channel : http://www.youtube.com/user/paraflysimulator
Advertisement
Are you asking how to get the direction of motion? Or how to compute the angle between the direction of motion and the forward vector?
Hi Jyk, well both to be honest, but i know i cant calculate the angle without knowing the direction of motion.

People tell me to use "get body velocity", but i dont see how this value is the direction of motion.

Thanks
Andy
Parafly Paragliding Simulator : http://www.parafly-sim.co.uk
Parafly Youtube Channel : http://www.youtube.com/user/paraflysimulator

People tell me to use "get body velocity", but i dont see how this value is the direction of motion.

Well, it is :) Assuming we're talking about linear velocity of course.

The direction of the linear velocity vector for an object is the direction in which it's moving; the magnitude/length of said vector is the speed with which it's moving. So, I think the linear velocity is indeed what you're looking for.

I can't really comment on the physics part of the problem, but as for computing the (unsigned) angle between two 3-d vectors a and b, a robust method is as follows:

angle = atan2(length(cross(a, b)), dot(a, b))
The input vectors need not be unit length, and the only time this will fail is when one of the vectors has zero length or near zero length.

There may be more to the physics than simply computing this angle, but as far as computing the angle goes, the above is an effective method.

This topic is closed to new replies.

Advertisement