- Home /
My ball goes the wrong way?
I am working on a game where a ball goes over beams to reach the finish. It has to be that when I click on "D" the ball goes to the right and when I click on "A" the ball goes left but the ball goes forward and rearwards. I'm using Unity 5. This is the code Where I think there is a mistake:
pragma strict
var rotationspeed = 100;
function Update () { var rotation : float = Input.GetAxis ("Horizontal") rotationspeed; rotation = Time.deltaTime; GetComponent.().AddRelativeForce (Vector3.back * rotation); }
When you can help me pls answere me. thank you in advance!
Answer by FirePlantGames · Mar 10, 2015 at 03:49 AM
AddRelativeForce (Vector3.forward * rotation);
Should do it.
Your answer
![](https://koobas.hobune.stream/wayback/20220613185612im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How do I fix these two errors in my Number Wizard Game? 2 Answers
Custom Cursor for my Game 1 Answer
Problem with unity build 1 Answer
What's wrong with my movement script? 0 Answers