Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • 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 /
avatar image
0
Question by Projekt-Krieg · May 05, 2013 at 01:42 PM · rotationinputlerpslow

Cant slow down rotation Speed

 var horizontal :float;
 var curhorizontal:float;
 var vertical:float;
 var curvertical:float;
 var turnspeed:float=0.02;
 function Update () {
     if (networkView.isMine){
         horizontal=Input.GetAxis("H")*turnspeed*Time.deltaTime;
         curhorizontal = Mathf.Lerp(curhorizontal,horizontal,Time.deltaTime);
         vertical=turnspeed*Input.GetAxis("V")*Time.deltaTime;
         curvertical = Mathf.Lerp(curvertical,vertical,Time.deltaTime);
         transform.Rotate(vertical,horizontal,0);
     }
 }

Hi, since a few days i try to regulate the rotiation Speed of diffrent Player Controllers.

In this Script, it dosnt matter what value "turnspeed" have, the Objekt rotate at the same speed.

Can anyone Help my out?

Comment
Add comment · Show 1
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 robertbu · May 05, 2013 at 03:44 PM 0
Share

Since this turnspeed is public, the value is the script will only be used when the script is attached to the game object. Changes in the script after that will be ignored. As @Trond suggest, make the change in the inspector. Or you can make the variable private:

 private var turnspeed:float = 0.02;

The variable will no longer appear in the inspector.

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by Trond · May 05, 2013 at 03:00 PM

Im not sure, but i guess that the inspector might overwright the "turnspeed". The inspector do sometimes take the first value a variable was set to and keeps it(atleast used to in earlier versions of unity). Therfore, trying to set a value for the variable where you define it might be a bad idea. You should instead try to change "turnspeed" in the inspector, OR set the value in Awake() or Start() like so:

 function Start(){
    turnspeed = 0.02;
 }
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 Projekt-Krieg · May 06, 2013 at 08:15 AM 0
Share

thanks, that helped

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

13 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

lerp to 0, problem with horizontal value 1 Answer

Need help on the 3ds max style camera control 0 Answers

hi, how to make topdown 2d lerp rotation on turret??. i.e. turret smoothly rotates on target.basic code below: 1 Answer

Clamped Turret Doesn't Want to Lerp the Other Way 2 Answers

Moving an object in a circle towards joystick 0 Answers


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