# Rotate towards velocity (2D)

Hi, I want to simulate arrow physics in my game, something minecraft-ish style would be good (when you throw the arrow straight up, when the velocity gets negative because of gravity it rapidly turns down), I can’t find any answer to this for 2d games, I want it to only rotate around the z axis, basically instead of making the projectile go forward but barely rotating, I want it to curve depending on the velocity. Any idea on how to do this?

edit: center of mass isn’t helping

If your arrow is a 3d object constructed so that the point looks at positive ‘z’ when the rotation is (0,0,0), then the 3D solutions you find (setting the LookRotation() to the velocity) will work in 2D.

If you are using a sprite for your arrow, then construct the sprite so the point of the arrow is to the right (x axis) with rotation is (0,0,0). Then you can do something like:

``````Vector2 v = rigidbody2D.velocity;
angle = Mathf.Atan2(v.y, v.x) * Mathf.Rad2Deg;
transform.rotation = Quaternion.AngleAxis(angle, Vector3.forward);
``````
```Vector2 v=GetComponent().velocity;
angle = Mathf.Atan2(v.y, v.x) * Mathf.Rad2Deg;
transform.rotation = Quaternion.Euler(new Vector3(0, 0, angle));

```