Nikita Goncharuk
Nikita Goncharuk

Reputation: 815

Rotation to Movement Vector2

I have a 2D GameObject with a component of Rigidbody 2d, and I want to move it forward based on its rotation (Rigidbody2D.rotation - z angle). How can i create movement Vector2?

Upvotes: 0

Views: 113

Answers (1)

Fredrik Widerberg
Fredrik Widerberg

Reputation: 3108

It depends what forward is in your game..

Is forward up?

this.transform.position += this.transform.up * Time.deltaTime;

Is forward right?

this.transform.position += this.transform.right * Time.deltaTime;

Upvotes: 1

Related Questions