- Home /
Question is not relevant
Slerp Problem?: Enemy in Constant Rotation!
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?
Please don't re-post if this question is the same as another.
http://answers.unity3d.com/questions/230775/character-gravity-problem-character-flies-upward.html
Please, look how I formatted your code and removed all the irrelevant parts, and do the same next time. It's going to save our time and you'll be more likely to get an answer. As for your question, sounds like alucardj took care of it.
Thank you for editing my script. I will keep in $$anonymous$$d how to do this for later.
But the question still isn't answered. Even IF I do not use Slerp in my script, I would still like the question to be answered for future reference and for all beginners using Unity.
Answer by You! · Mar 24, 2012 at 01:39 AM
I am creating a link to a similar question. Although it refers to "Lerp," it should help explain how to use "Slerp..."
http://answers.unity3d.com/questions/230832/how-to-use-lerp.html
Follow this Question
Related Questions
How to use Lerp? 3 Answers
Rotating on X and Z axis only 2 Answers
How to Rotate on one axis? 4 Answers
Enemy AI Problem: Dancing? 1 Answer
Character Rotation - Script not functioning correctly 1 Answer