- Home /
make object move in the same direction it faceing
back to my last question http://answers.unity3d.com/questions/1416684/rotate-an-object-with-keyboard.html now i give my weapon the same direction and that work put it not move in the same direction that i want
i try to use transform.position += transform.forward Time.deltaTime movementSpeed; but it just not moving
Comment
Answer by CaffeineAndCoffee · Oct 07, 2017 at 05:59 PM
I would suggest adding a rigid body to your player if there isn't one already. If you are using a rigid body, use can do this:
Rigidbody rb;
float speed = 10f;
void Update() {
rb.AddForce(speed * Input.GetAxis("Vertical") * transform.forward * Time.deltaTime);
}