Jump to content
  • Advertisement
Sign in to follow this  
saravananps

Camera Problem

This topic is 4322 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

Hi, i want my camera to adjust it's view (look vector) when i click an object in the scene, so that the object is positioned in the center of camera view. I tried to implement this by 1. When the mouse button is clicked compute the mouse cursor value at this position and find the camera space coordinates 2. transform the camera space coordinates to world space. 3. i used this world space value as a direction vector and assigned this vector to my look vector of the camera. But i can't get the expected result. Is there any other better solution for this problem? If so please help me. Thanks

Share this post


Link to post
Share on other sites
Advertisement
How about:

new camera look at = old camera look at + x * camera right + y * camera up

where -1 <= x <= 1 and -1 <= y <= 1.

X and Y are the mouse coordinates scaled to +/- 1, i.e. normalised to the view window.

Skizz

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!