How do I find the directional vector
I have the pitch, roll, and yaw from user input in my OpenGL program and I want to calculate the directional vector from this and the position of the object. Can somebody please explain to me how I do this? Thanks!
Assume that the direction vector is and the position of your object is P.
D.x = P.x + sin(yaw) * sin(pitch+90º)
D.y = P.y + cos(yaw)
D.z = P.z + cos(yaw) * -sin(pitch+90º)
I''d explain the math but it''s been a year since I wrote the code that implements this so I probably don''t remember the math myself
No, HTML is not an OO language.
D.x = P.x + sin(yaw) * sin(pitch+90º)
D.y = P.y + cos(yaw)
D.z = P.z + cos(yaw) * -sin(pitch+90º)
I''d explain the math but it''s been a year since I wrote the code that implements this so I probably don''t remember the math myself
No, HTML is not an OO language.
Check out my raytracer at http://simp-raytracer.sourceforge.net. Download it at http://www.sourceforge.net/projects/simp-raytracer.
ok I implemented that, but I don''t think it works. If I add the normalized view vector to the position of the object, I should get the objects position, right? well i did that and the thing doesn''t move in the right direction. Humm...does anybody have some sample code to show this. This thing is driving me crazy and I don''t want to have to figure it out! Thanks anyways
August 01, 2002 10:04 AM
you should probably convert the rotation to radians first.
search for deg2rad or something (degrees to radians)
search for deg2rad or something (degrees to radians)
August 01, 2002 10:12 AM
btw, and maybe im missing something, but that bit of code didnt include anything about roll, only pitch and yaw...
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement