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 Kamedelgado · Aug 03, 2013 at 09:35 AM · rotation

Problem with rotation

I'm using this script to rotate my plane, but when it rotates it also moves its transform on the Z axis, how can i fix this?

 if (Input.GetKey(KeyCode.LeftArrow))
     transform.Rotate(Vector3.up * rotspeed * Time.deltaTime);
  
  if (Input.GetKey(KeyCode.RightArrow))
     transform.Rotate(-Vector3.up * rotspeed * Time.deltaTime);
Comment
Add comment · Show 5
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 · Aug 03, 2013 at 12:53 PM 0
Share

There is nothing here that would change the position. Is the plane a child and is the script on the parent?

avatar image CG-DJ · Aug 04, 2013 at 03:49 AM 0
Share

Do you have a rigid body on the plane? Just a wild guess...

avatar image LightStriker · Aug 04, 2013 at 05:38 AM 0
Share

How is your object axis when playing? Is your object modelized along the world axis?

avatar image GC1983 · Aug 04, 2013 at 07:41 AM 0
Share

Rigidbody will not effect rotations unless told to. Using transform will still work with or without a rigidbody.

avatar image pako · Aug 04, 2013 at 08:10 AM 1
Share

Is your pivot point at the center?

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by GC1983 · Aug 04, 2013 at 07:40 AM

There could be a series of issues of why yours is not working...possibly due to alterations that you made that you might have not realized. Could be settings....either way. rotating on any axis is simple as one line of code. If its not working, its probably something youre overanalyzing. Check this link. It should help.

http://answers.unity3d.com/questions/9019/how-to-set-a-single-axis-rotation-of-a-gameobject.html

Comment
Add comment · 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

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

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

Related Questions

The name 'Joystick' does not denote a valid type ('not found') 2 Answers

rotation relative to world / starting position 1 Answer

How to tilt the gameobject based of Input.Acceleration? 0 Answers

Making the enemy always face the player 1 Answer

Simple lerp roation problem 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