title says it all,
how do I make an object move forward based on it’s rotation with a script? (unity 2D)
I can’t find any tutorials, I don’t know if I phrased this right.
title says it all,
how do I make an object move forward based on it’s rotation with a script? (unity 2D)
I can’t find any tutorials, I don’t know if I phrased this right.
I don’t understand what you mean by, “I want to make an object move forwards based on it’s rotation.” Do you want to move it in the direction it’s facing?
yes, I want to move it in the direction it’s facing
I think this part of the Script Reference will be helpful, it pretty much lays out the code you need:
Cheers!
Create a sphere, give it a rigidbody, apply force. It will roll. I posted a script today that does this using the new input system.
Use Transform.forward
I think its too early for you to try unity’s bonkered physics. just keep adding
transform.position += transform.forward * speed * time.deltatime;
no need of rigid body. you can make up acceleration and deceleration too easily by increasing speed while forward button is held down and decrease speed until zero when the button is released. if you need it
wander into rigidbody waters later