I am trying to make credits, and i want to try to move the camera down slowly to have my credits, i use 3D text and javascript. Thanks!
Put this script on the main camera.
var distance;
var target : Transform;
private var lookAtDistance = 999999999.0;
private var attackRange = 999999999.0;
var moveSpeed = 5.0;
private var damping = 6.0;
private var isItAttacking = false;
function Update ()
{
distance = Vector3.Distance(target.position, transform.position);
if(distance < lookAtDistance)
{
isItAttacking = false;
lookAt ();
}
if(distance > lookAtDistance)
{
}
if(distance < attackRange)
{
attack ();
}
if(isItAttacking)
{
}
}
function lookAt ()
{
var rotation = Quaternion.LookRotation(target.position - transform.position);
transform.rotation = Quaternion.Slerp(transform.rotation, rotation, Time.deltaTime * damping);
}
function attack ()
{
isItAttacking = true;
transform.Translate(Vector3.forward * moveSpeed *Time.deltaTime);
}
Sorry it’s a bit messy. It was an AI script and I reformatted it a bit. I hope it helps!