Can somebody put me out of my misery. I’ve checked a load of threads on the subject but i still don’t really get it. OK I don’t want gimbal lock any more than the next man but i do want to rotate game objects in a predictable fashion. Let me try and to get to the quick of it. Say I want to use an expression such as:

I know oldRotation because it’s the current value of transform.rotation (i.e. a quaternion) but all I know about newRotation is that it’s (x,y,z) degrees. How do i calculate newRotation Anyone speak quaternion?

the argument for this function is 3 seperate variables rather than a single Vector 3 so if i need to define newRotation as an exposed variable i do this right?

var newPostion.x : float;
var newPostion.y : float;
var newPostion.z : float;
newRotation = Quaternion.Euler(newRotation.x, newRotation.y, newRotation.z);

One of the things that’s confusing for beginners is the relationship between the transform as seen in the inspector and the transform as used in scripting. You expect it be an object with 3 (Vector 3) variables.
BTW Am i right in assuming scale is just not on the menu as far as scripting goes?

One final question on this thread. This little co-routine works but produces quite idiosyncratic behavior. e.g random amounts of ‘faffing’ around before starting the movement, somtimes nothing for 1/2 the time then a sudden lurch. It’s fine until the distances get above 10.0 or so and It’s much worse if i substitue Slerp for Lerp.

function Move ()
{
newRotation = Quaternion.Euler(dockRotation);
for (t=0.0; t<=1.0; t+=Time.deltaTime * dockingSpeed)
{
transform.position = Vector3.Lerp(transform.position, dockPosition, t);
transform.rotation = Quaternion.Lerp(transform.rotation, newRotation, t);
yield;
}
transform.position = dockPosition; //correct final position
transform.rotation = newRotation;
}