• 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
Question by You! · Mar 23, 2012 at 07:35 AM · rotationjavascriptenemybeginnerslerp

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

People who like this

0 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
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

People who like this

0 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?

Unity Answers is in Read-Only mode

Unity Answers content will be migrated to a new Community platform and we are aiming to launch a public beta on June 13. Please note, Unity Answers is now in read-only so we can prepare for the final data migration.

For more information and updates, please read our full announcement thread in the Unity Forum.

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

Enemy AI Problem: Dancing? 1 Answer

How to use Lerp? 3 Answers

Rotating on X and Z axis only 2 Answers

How to Rotate on one axis? 4 Answers

JS to C# converting issues.. 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges