# Rotation from speed

**URL:** <https://forum.kirupa.com/t/rotation-from-speed/216471>\
**Category:** Uncategorized\
**Created:** [February 16, 2007, 8:51pm UTC](https://forum.kirupa.com/t/rotation-from-speed/216471 "2007-02-16T20:51:26Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mario\_hater](https://avatars.discourse-cdn.com/v4/letter/m/e0b2c6/32.png) [@mario\_hater](https://forum.kirupa.com/u/mario_hater)\
**Post date:** [February 16, 2007, 8:51pm UTC](https://forum.kirupa.com/t/rotation-from-speed/216471/1 "2007-02-16T20:51:26Z")

</div>

i have some simple enemys in my game that have two variables, an xspeed and a yspeed. Is there any way to get a rotation for the enemy from those values. Something like this: \_rotation=Math.tan(yspeed/xspeed)
