Sign in to follow this  
Medo Mex

Camera looking at the same point the mesh is looking at

Recommended Posts

Medo Mex    891
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
Nik02    4348
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. [b]You [/b]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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this