Sign in to follow this  
Multiverse

Plane flight path

Recommended Posts

hello there. im having trouble getting planes to fly to a selected destination (with the mouse) in a 3D air traffic control program. I can 'pick' the planes with the left mouse button, but i want to be able to right click to set a new destination that the plane will fly towards. this is my basic procedure so far: 1) find difference between clicked destination and current position (vector subtraction) 2) find dot product between current direction and the new 'difference' vector found by subtraction. 3) depending on the angle between the two, turn the plane clockwise or anti clockwise. i think that part of my code works fine, but im pretty sure the problem lies with my 'picking' the new destination coordinates. i try projecting a ray down to the selected planes altitude (z position), but it doesnt give the correct coordinates. if anyone has any clues for me or can see anything stupid in my theory please let me know!! and a possible solution would be greatly appreciated!! :D Edit: if i would be better posting this in the math/physics forum let me know and i'll delete and repost in there. [Edited by - Multiverse on September 2, 2004 12:30:26 PM]

Share this post


Link to post
Share on other sites
Ähm... Sorry if this sounds stupid, but how do you determine the _three_ coordinates of the destination point? I understand that you can pick a plane (since you do a collision test with rays into the z plane, I suppose), but how can you define three coordinates with clicking on a 2d monitor?
In other words: Are you positive that you have the correct destination coordinates? (As I understand it, your target z value must always be "0" (or whatever value represents your back or front clipping plane)).

If you can clarify (or flame me for talking complete nonsense here :-)), it might help!

Share this post


Link to post
Share on other sites
it doesnt sound stupid, its probably me wrped logic that threw you off what i was saying. :(

basically i'd pick the point with the mouse, use this as the origin of a ray, and project a ray into the screen in exactly the same way as picking. Then i normalize the direction and do a scalar multiplication using the airplanes distnace from the screen.

my vector math isnt that hot, and to my knowledge all the theory is fine. but i may be wrong, all i need is someone to put me right! (i think anyway, maybe im just going about it all wrong.)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this