• Advertisement
Sign in to follow this  

Camera looking at the same point the mesh is looking at

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

CORRECTION: How do I make a mesh look at the same point the camera is looking at?

Basically, I want to change the mesh rotation to make it look at the same point the camera is looking at. Edited by Medo3337

Share this post


Link to post
Share on other sites
Advertisement
Assuming I understood your intent correctly, you can use atan2 to find an angle given x and y coordinates (of the point). You would then use this angle to rotate the mesh. For true 3d rotation, things become a bit more difficult, but you could use quaternions or two separate rotation planes for the same effect.

Aside from that, a "camera" (in context of computer graphics) usually "looks" along an infinite line as specified by the view and projection transformation. The view transform is usually calculated given an "eye point" and a "lookat point", though, which I assume you have already.

Also note that a mesh, being just a soup of geometry, does not intrinsically "look at" in any direction. You are the one who defines the logical orientation of the mesh; that is, which direction is "forward", "up" etc. The computer could not care less if the mesh happens to portray a model of a human, animal or other physical entity.

Share this post


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

  • Advertisement