Jump to content
  • Advertisement
Sign in to follow this  
comdown

What kind of turning is this??

This topic is 2975 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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!