- Home /
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));
}
Your answer
![](https://koobas.hobune.stream/wayback/20220613085336im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Rotate to facing direction 2.5D 2 Answers
Is there a way to detect which way an object is facing? 1 Answer
Car goes a bit left when moving 1 Answer
reseting rotation of objects? 0 Answers
2D Multi-Wheel Collider/wheel, detecting Wheel Hits 0 Answers