Hey guys, i need help smoothing my rotation on this script. what it does it rotate my turret towards the enemy and locks the Y axis. what i need is to smooth the turrets rotation, while still locking the axis. How would i use slerp or smoothdamp in this script? Thanks, here’s the script:
Script:
var target : GameObject;
var ToTarget;
function Update () {
target = GameObject.FindGameObjectWithTag("Enemy");
ToTarget = target.transform.position - gameObject.transform.position;
ToTarget.y = 0;
gameObject.transform.forward = ToTarget;
}
Another option I sometimes prefer is to keep track of a target position (Vector3) which slowly chases after the actual target, then use transform.LookAt() to face that point.