# Is this possible? - Searched all of Fk... Tuts and Movies!

**URL:** <https://forum.kirupa.com/t/is-this-possible-searched-all-of-fk-tuts-and-movies/177875>\
**Category:** programming\
**Created:** [February 6, 2006, 4:35am UTC](https://forum.kirupa.com/t/is-this-possible-searched-all-of-fk-tuts-and-movies/177875 "2006-02-06T04:35:42Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![zicemaster](https://avatars.discourse-cdn.com/v4/letter/z/b77776/32.png) [@zicemaster](https://forum.kirupa.com/u/zicemaster)\
**Post date:** [February 6, 2006, 4:35am UTC](https://forum.kirupa.com/t/is-this-possible-searched-all-of-fk-tuts-and-movies/177875/1 "2006-02-06T04:35:42Z")

</div>

For the life of me… I cannot find if it is possible to make an object rotate toward the direction it is travveling.

Heres my current code, it’s kind of bad… If you look close you can see it’s wrong.  
[http://photobucket.com/albums/y232/minyMonkey/MySpace%20SWFS/?action=view&current=tank.swf](http://photobucket.com/albums/y232/minyMonkey/MySpace%20SWFS/?action=view&current=tank.swf)

Just cut out the part I want you to see, this is on the rocket.

```auto

angle = _rotation;
    xSpeed = speed*Math.cos(angle*Math.PI/180) +_root.landSpeed;
    ySpeed = speed*Math.sin(angle*Math.PI/180);
    //Friction and gravity
    friction = .99;
    gravity = .25;
}
onClipEvent (enterFrame) {
    xSpeed = xSpeed*friction;
    ySpeed = ySpeed-gravity;
    //Set rotation based upon speed
    if (xSpeed>0 & angle<60) {
        _rotation = -(-ySpeed*4);
    } else {
        _rotation = -(-ySpeed*5);
    }

```
