Polar angles to target in 3d space

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
NewImage
Posts: 8
Joined: Wed Feb 11, 2009 3:07 am

Polar angles to target in 3d space

Post by NewImage »

Hi
I have a 3d model of a jet and a target. My problem is I need to get the angle to the target from the horizon of the 3d model, and need the angle off a vertical plane that cuts the model down the center.
Anyone know how to do this?

I need these 2 angles so I can feed then into a neural network so when the angles are both 0, I know that the ship is pointing right at the target
Nox
Posts: 304
Joined: Wed Jan 14, 2009 6:23 pm

Post by Nox »

Well. Just take a look at the vector3d class. There is a method which may satisfy your needs.
NewImage
Posts: 8
Joined: Wed Feb 11, 2009 3:07 am

Post by NewImage »

the gethorizontlangle() makes the wing of the model point at the target, so when i add 90degrees to the y, it almost points at it, but points slightly above or below it, and it always orients the model with the same side facing up. I think its because my model is not based with the front being on the z access
Post Reply