# dyanmic physics 'lock rotation' VS alignAxisToVect

with the dynamic physics options ‘lock rotation’ of x and y, I was hoping that my problems would be solved. however , in my code using alignAxisToVect in order for objects to find their next way points and turn to them, even with these ‘lock rotation’ options checked off the object getting its axis aligned will still rotate on these axes.

if this is not to be gone around, can someone explain the expression i could write, possibly, for the applyRotation method (as in, how to calculate a difference in radians between objects)

or if there is some other way.

right now, its basically just 'if this, alignAxisToVect(objectVector,1,1 <<or .4, or whatever. if the application time is shorter, the crazyness of the axis rotations are less apparent>>)

With alignAxisToVect() you manipulate the orientation of the object directly. It does not include any outside limitations of the physics engine (it is not a physics operation).

If I understand you correctly you want to turn towards a certain object (waypoint) or at least to it’s position.

I would check if the waypoint is left or right from the current orientation. If it is left … turn left, if it is right … turn right.

This is the basic operation.

Do you want

• a constant turn speed (e.g. 1° per frame) or
• a turn with acceleration (starting with slow turn but gets faster and stops slow)
• a small turn step when a full turn step would exceed (e.g. from left to right)
?

Hint: you can perform a left/right check with the dot product on the vectors:

• vector from current position to target position in world space
• vector to the right side (local x) in world space

if the dot product is

• below zero the target is left
• above zero the target is right
= 0 it is either on the XZ-plane (you might perform a front/back check in that case)

thank you for the reply. as for what im interested in, i just want whatever is going to provide the lowest cpu usage for logic, and then lowest for physics too. so i will have to try this if left left if right right thing