Sign in to follow this  
comdown

What kind of turning is this??

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
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this