Advertisement Jump to content
Sign in to follow this  

y-axis rotation of camera match object

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

I am trying to get the y-axis rotation of the camera to correspond with the rotation of an object; the object is aligned with the camera on its front vector does anyone have any suggestions/help on how to do this; so it rotates correctly? I have a y-axis based rotation I use for the camera; its stored as a float, but that doesn't seem to help. I tried setting that to the rotation of the object and it kinda would spin fast as I turned right and slow back down if I turned left. [Edited by - DevLiquidKnight on June 17, 2005 10:17:12 PM]

Share this post

Link to post
Share on other sites
Guest Anonymous Poster
If I understood correctly, what you are trying to do is:
object.rotation.y = camera.rotation.y + PI;

Share this post

Link to post
Share on other sites
according to Game Programming Gems 2, there is an article about "Mario 64", a 3rd person control.

u need 3 direction vectors, camera's front vec, right vec & input's dir vec, 1st an alternative normalized camera front vec :

2nd, an alternative normalized camera right vec :

then the input dir vec, assume up(y)=1, down(y)=-1, left(x)=-1, right(x)=1. Normalize it also.

so the final Direction Vector for character is :
final.x=(input.x * vRight.x) + (input.y * vDir.x);
final.z=(input.x * vRight.z) + (input.y * vDir.z);

then if u need the Y-radius of the final vector, do the following:
if (final.x>0.0f)

Share this post

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

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!