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 vratislavino · Dec 02, 2013 at 08:29 PM · playerkeyboardmovingrotating

Keyboard rotating - left is stopping object

Hi,

when I rotate right during moving forward, it will do both - moving and rotate (my track will be a circle), but when I rotate left, it will do only rotation, my movement speed is 0 (my track is point of rotation).

For moving I use parts of Character Controller from Standard Assets (Character Controller, Character Motor, FPSInput Controller)

and I have this easy script for rotating player with keyboard:

 void Update()
     {
         float speed = 100f;
 
         if (Input.GetButton("left"))
         {
             gameObject.transform.Rotate(-transform.TransformDirection(Vector3.up), Time.deltaTime * speed);
         }
         
         if (Input.GetButton("right"))
         {
             gameObject.transform.Rotate(transform.TransformDirection(Vector3.up), Time.deltaTime * speed);
         }
 }

Buttons are correctly preset in Edit->Project Settings -> Input left positive button is q and right positive button is e

Comment
Add comment · Show 2
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 · Dec 02, 2013 at 08:33 PM 0
Share

I've seen this with characters that have child objects with colliders. If you have child objects of the character, try disabling them, or at least disabling their colliders.

avatar image vratislavino · Dec 03, 2013 at 05:25 AM 0
Share

It didnt help, man :(

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by TheMidn1ght · Dec 03, 2013 at 12:39 AM

Instead of doing "-transform" try doing -speed at the end of the function and remove the - from your transform.

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 vratislavino · Dec 03, 2013 at 05:35 AM 0
Share

Still the same :/

I tried to do

gameObject.transform.rotation = new Quaternion(0, gameObject.transform.rotation.y - speed, 0, gameObject.transform.rotation.w);

but, it has interesting issue. When I'm facing one direction, it has rotating speed about 0.001f a and when i turn around, it will have normal 1f as I had

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

17 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 avatar image avatar image avatar image avatar image

Related Questions

Rotate camera around moving object 2 Answers

Animations Only Playing Once Per Key Press 0 Answers

Moving the Camera around my Player 0 Answers

player not moving after respawn(java script) 1 Answer

Moving and rolling a cube 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