Mesh Face Camera

Get answers to all your basic programming questions. No Ogre questions, please!
marcalaque
Kobold
Posts: 29
Joined: Sun Jul 21, 2013 9:51 am

Mesh Face Camera

Post by marcalaque »

I have a problem on how to set the entity or the mesh file face the camera current position
My game is having a first person camera wherein I will also set up an OIS left click where the mesh file will face towards the camera
Any help?? :D
User avatar
spacegaier
OGRE Team Member
OGRE Team Member
Posts: 4304
Joined: Mon Feb 04, 2008 2:02 pm
Location: Germany
x 136

Re: Mesh Face Camera

Post by spacegaier »

Use this as a base, but instead of rotating your mesh in the walking direction as explained in the example, use your camera position as the rotation target:

Wiki Article: Rotate Character to face into walking direction
Ogre Admin [Admin, Dev, PR, Finance, Wiki, etc.] | BasicOgreFramework | AdvancedOgreFramework
Don't know what to do in your spare time? Help the Ogre wiki grow! Or squash a bug...
marcalaque
Kobold
Posts: 29
Joined: Sun Jul 21, 2013 9:51 am

Re: Mesh Face Camera

Post by marcalaque »

So what you are trying to say that I will use the lookAt() method? or something like yaw(), pitch(), node()
User avatar
spacegaier
OGRE Team Member
OGRE Team Member
Posts: 4304
Joined: Mon Feb 04, 2008 2:02 pm
Location: Germany
x 136

Re: Mesh Face Camera

Post by spacegaier »

Yes either the getRotationTo or lookAt. Both should match your requirements, at least off the top of my head.
Ogre Admin [Admin, Dev, PR, Finance, Wiki, etc.] | BasicOgreFramework | AdvancedOgreFramework
Don't know what to do in your spare time? Help the Ogre wiki grow! Or squash a bug...
marcalaque
Kobold
Posts: 29
Joined: Sun Jul 21, 2013 9:51 am

Re: Mesh Face Camera

Post by marcalaque »

Thank you very much for the ideas I will use them on my game :D