Jump to content
  • Advertisement
Sign in to follow this  
DeadlyDan

Rotate View Around Vector

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

Hi

I've been trying to figure out how i can rotate my view around a vector. I have created this diagram:

leaningg.jpg
Basically i have a 3d vector of X Y and Z called EYES. I create an offset of EYES lower down the y-axis.What i think i need to do is apply Yaw Pitch Roll rotation to the offset vector and then multiply it by the distance (120 units) which will result in the rotated vector, then calculate the dot product between the first vector and the end vector to rotate the view.

The part i am unsure of is how to get the resulting vector from the offset vector based on rotation. Could anyone help me?

Thanks,
Dan

Share this post


Link to post
Share on other sites
Advertisement
I'm not totally clear about what you are doing.

But it looks to me as though you are trying to rotate your eyes vector around the offset.

If this is the case then it's simply a matter of subtracting one vector position from the other ( eyes pos - offset pos : we'll call this distance : vec 3 x,y,z ), perform the rotation and then add distance back to eyes.

This moves your eyes vector so that it's relative to the origin and not the offset for the rotation.

KJM

Share this post


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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net 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!