Aligning question

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

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 on other sites
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 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.

• What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 15
• 14
• 46
• 22
• 27
• Forum Statistics

• Total Topics
634047
• Total Posts
3015226
×

Important Information

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!