• 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 mvpires · Dec 12, 2012 at 09:52 PM · rotatemarble

I need help to rotate a plane and other tips

I'm making a game like Marble, but the player doesn't move the ball, only the plane/board by rotating it. How can I do this? I've searched through this foruns for a similar answer but couldn't find. Thanks for the attention in advance.

Edit: Found a partial solution in this topic: http://answers.unity3d.com/questions/278648/how-to-rotate-a-plane-with-script.html

but the plane only rotate left or right.

here's the code

 void Update ()
     {    
        transform.Rotate((Vector3.forward * Input.GetAxis("Horizontal") * 2) + (Input.GetAxis("Vertical") * Vector3.forward * 2));        
     }

Edit 2: I've fixed the rotation, but now I need to put a limit on this rotation (so the plane don't go crazy) and attach some cubes to the plane.

Here's the code fixed:

 void Update ()
     {    
        transform.Rotate((Vector3.left * Input.GetAxis("Horizontal") * 1) + (Input.GetAxis("Vertical") * Vector3.forward * 1));        
     }
Comment
Add comment
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

0 Replies

· Add your reply
  • Sort: 

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.

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

9 People are following this question.

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

Related Questions

Make Camera and Character Face Same Direction 1 Answer

Rotation drops FPS 1 Answer

How do I Rotate a Skybox's Material 4 Answers

Camera rotation around player while following. 6 Answers

Script is working incorrectly. (rotation) 1 Answer

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