Rotating a group of objects, torwards a direction

Hi,

I’m tryng to rotate a group of objects(in the same sense, clockwise for example) , torwards a direction.

Right, now i’m doing the following :

var targetRotation = Quaternion.LookRotation(targetPos - transform.position, Vector3(0,1,0));
oldRotation = transform.rotation;
transform.rotation = Quaternion.Lerp(oldRotation, targetRotation , the_speed);

This works just fine if i move one single object.
Let’s imagine 2 objects, X and P

____X_______P

____T

In this case, object X will turn clockwise and object P will turn anti-clockwise.
Is there a way to make them both turn clockwise, so they don’t colide when turning ?

thanks,
Bruno

Hiya,

Quaternions are funny old things. One of their properties is that they always take the shortest path between two rotations. (Think of the rotations as points on the surface of the globe. Lerping between them will always take the shortest path and never the longer one.) I think you will need to lerp the Euler angle in degrees to get the rotation you need.

Thanks,
Graham

Another way to go is to break the rotation into two quaternions, each equal to half the angle you need.