I am having a problem with an enemy in my game where the enemy is constantly rotating. I used Quaternion.Slerp to control rotation. Here is my script:
@script RequireComponent(CharacterController)
public var MarManRotateSpeed : float;
public var attacktarget : Transform;
private var selfplace : Transform;
// [...]
function Start()
{
selfplace = transform;
}
function Update(){}
function CoUpdate()
{
Debug.LogWarning("Success?");
while(true)
{
// [...]
var target : Transform;
target = attacktarget;
selfplace.rotation = Quaternion.Slerp(selfplace.rotation,
Quaternion.LookRotation(target.position-selfplace.postition),
MarManRotateSpeed * Time.deltaTime);
// [...]
}
}
Am I using Slerp wrong? How do I fix it?