Jump to content
  • Advertisement
Sign in to follow this  

What kind of turning is this??

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

There are lots of ways to rotate a object. but i'm reading a strange code.

This is methods that rotate a game object.


float fRotDir = (-1 or +1);
Vector NewForward = CurrentForwardVector + (CurrentSideVector * fAngularSpeed * fRotDir);
D3DXVec3Normalize(&NewForward, &NewForward);

I tested this code, but it doesn't make any sense for me.

I want to set angular speed (in degree per sec) and i want to rotate exactly that amount.

Can anybody explain that turning methods?

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by comdown
There are lots of ways to rotate a object. but i'm reading a strange code.

This is methods that rotate a game object.


float fRotDir = (-1 or +1);
Vector NewForward = CurrentForwardVector + (CurrentSideVector * fAngularSpeed * fRotDir);
D3DXVec3Normalize(&NewForward, &NewForward);

I tested this code, but it doesn't make any sense for me.

I want to set angular speed (in degree per sec) and i want to rotate exactly that amount.

Can anybody explain that turning methods?
If you want to be able to specify the angular speed exactly, you'll probably want to use a different method. That method offsets the forward direction laterally and then renormalizes, which is suitable in some cases, but doesn't give you the kind of control you're talking about.

If you want to rotate at a fixed rate, you'll probably just want to apply an axis-angle rotation using the normal methods. (The details will depend on the context and on what math library you're using.)

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!