I am really breaking my head with this... I just can't think and imagine it anymore!
The Problem
I want the user to click the waypoint and then drag it.
The waypoint is a 3D object. So you have to calculate where it is when the mouse moves. The big problem is, that the waypoint will change it's distance from the camera when being moved over an uneven landscape.
The Numbers
I am doing my calculations with proportions. So lets say the distance the waypoint is away from the camera is y#. The mousex and y positions will be mx# and my#. Since I have a 800*600 resolution, they will be floats. (You will see later on.) px# and pz# will be the updated waypoint positions (return value).
I figured out, that if y#=400,
px#=(mx#*(640.0/800.0))-(640.0/2.0)
py#=0-((my#*(640.0/800.0))-(480.0/2.0))
Because the window is 800*600, you have to multiply the mouse position by (640/800) because if y#=400 in a 640*480 window, they would be correct.
Now what if y#=93.4837? How would I figure that out? I have really tried and I just didn't get it...
TheComet
Peachy, and the Chaos of the Gems
