Jump to content
  • Advertisement
Sign in to follow this  
Funkyjive

Aligning question

This topic is 3773 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Ok this one has me compleatly stumped. I do not know how to attack this problem. Heres the setup... I have a camera represented by an x,y,z position in 3d space also with pitch and heading properties. I also have a rectangle in space with a center...x,y,z a normal vector and an "up" vector. I also have a second one of these rectangles somewhere else in space with possibly a different orientation than the first. What I need to do is place my camera at a position and orientation away from the second rectangle exactly as it is from the first. The hard part I figure will be trying to figure in the possible difference in orientations of the planes. Any suggestions on how to get started on this problem? I hope I made this clear enough. Thanks in advance!

Share this post


Link to post
Share on other sites
Advertisement
calculate the difference in the up vector between the two rectangles. this will telll you what kind of rotation to apply to the camera. next calculate the distance from the camera to cube 1 add that distance to the location of cube 2 and that will give you the new location for the camera.

Share this post


Link to post
Share on other sites
You may want to use matrices to represent the camera orientation and the orientation of each plane.

To move the camera from one plane to another with the same relative orientation, camera_mat *= inverse_plane1_mat * plane2_mat.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!