How can I do it ? I don’t know how it works and I didn’t found an example in the FAQ ^^’
I just want the camera move once or twice around an objet before stopping.
How can I do it ? I don’t know how it works and I didn’t found an example in the FAQ ^^’
I just want the camera move once or twice around an objet before stopping.
I’ve modified the code of MouseOrbit. It works fine but now I’d like the camera begins in front of the target (z axis) and ends at the rear.
I’ve tried this code, but the camera is not really in front of the target :
function Start ()
{
var angles = transform.eulerAngles;
x = angles.y;
y = angles.x;
z = angles.z;
// Make the rigid body not change rotation
if (rigidbody)
rigidbody.freezeRotation = true;
}
function LateUpdate ()
{
if (target)
{
//x += 0.8;
y = 30;
var rotation = Quaternion.Euler(y, x, z);
var position = rotation * Vector3(0.0, 0.0, -distance) + target.position;
transform.rotation = rotation;
transform.position = position;
}
}