var target : Transform;
function Update() {
transform.LookAt(target);
transform.Translate(transform.forward, target);
}
- Object is coming at the player (target) too fast. How can add some sort of speed variable that I can change to modify how fast objects come at the camera?
Thank you
var speed = 0.1;// (or whatever number you want)
// then modify your code as
transform.forward * Time.deltaTime * speed
And it might also be good idea to normalize transform.forward by using transform.forward.normalized, so you’ll get better control with speed variable.
Thank you mate! that did it. I love this forum.
That should not be necessary (the ‘forward’ vector should be unit length already).