- Home /
Question by
peterberens2000 · Jun 29, 2018 at 12:46 PM ·
c#movement2d gamedirection
Trying to move my gameobeject in a certain direction (2D, C#)
In 3D I assume I would just rotate the object then use transform.forward but that doesn't work in 2D. I can move my object up, down, left or right but I want to be able to point in a direction then move that way till i get stopped. Is there a "front" to 2D objects?
Comment
Best Answer
Answer by Hellium · Jun 29, 2018 at 12:56 PM
Yes, it's transform.right
, supposing your sprite asset is correctly oriented (facing right)
but if i rotate my object will it not still just move to the right?
No, because transform.right
is different from Vector3.right
. It changes when the object rotates.