Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


We're also offering banner ads on our site from just $5! 1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Camera looking at the same point the mesh is looking at


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 Medo3337   Members   -  Reputation: 673

Like
0Likes
Like

Posted 13 November 2012 - 08:37 PM

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, 14 November 2012 - 02:35 AM.


Sponsor:

#2 Nik02   Crossbones+   -  Reputation: 2875

Like
0Likes
Like

Posted 14 November 2012 - 02:21 AM

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.

Niko Suni





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS