Public Group

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

## 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 on other sites
Quote:
 Original post by comdownThere 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.)

1. 1
Rutin
42
2. 2
3. 3
4. 4
5. 5

• 9
• 27
• 20
• 14
• 14
• ### Forum Statistics

• Total Topics
633387
• Total Posts
3011607
• ### Who's Online (See full list)

There are no registered users currently online

×