• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
This question was closed May 25, 2012 at 11:10 PM by You! for the following reason:

Question is not relevant

avatar image
0
Question by You! · Mar 23, 2012 at 07:35 AM · javascriptrotationenemybeginnerslerp

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?

Comment
Add comment · Show 3
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image AlucardJay · Mar 23, 2012 at 08:22 AM 2
Share

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

avatar image Berenger · Mar 23, 2012 at 04:29 PM 0
Share

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.

avatar image You! · Mar 23, 2012 at 11:55 PM 0
Share

@Berenger

Thank you for editing my script. I will keep in mind 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.

1 Reply

  • Sort: 
avatar image
0
Best Answer

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

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image You! · Mar 24, 2012 at 06:31 AM 0
Share

Ideas from anyone else?

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Rotating on X and Z axis only 2 Answers

How to Rotate on one axis? 4 Answers

How to use Lerp? 3 Answers

Enemy AI Problem: Dancing? 1 Answer

LookRotation Vector3 is Zero, Yet Slerp Still Rotates? 2 Answers

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges