I’m using javascript.
I want to rotate a car with an onscreen button.
It’s easy to to create a button, and easy to create a car.
It’s easy to even create a car that if clicked/pushed down will rotate.
What I’m having trouble with, is creating an onscreen button that when pushed down with something like OnMouseButtonDown () will rotate the car.
What I have done is I have a car that the main camera follows. I have a button that moves with the car and is under the car in the hierarchy.
I had two ideas to solve the problem, but I don’t know how to do either.
Is there any way to reference whether or not a button is pushed down in another script?
Is there any way to control another game object with a script from a different object?
If you have any other ideas to solve the problem they would also be appreciated.
Thanks