# Learning some trig

**URL:** <https://forum.kirupa.com/t/learning-some-trig/197821>\
**Category:** Uncategorized\
**Created:** [August 19, 2006, 3:36pm UTC](https://forum.kirupa.com/t/learning-some-trig/197821 "2006-08-19T15:36:46Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mlecho](https://avatars.discourse-cdn.com/v4/letter/m/87869e/32.png) [@mlecho](https://forum.kirupa.com/u/mlecho)\
**Post date:** [August 19, 2006, 3:36pm UTC](https://forum.kirupa.com/t/learning-some-trig/197821/1 "2006-08-19T15:36:46Z")

</div>

hi guys…doing an exercise with the mouse and some trig…i made [this](http://project.foldedmap.com/projects/van)little car. Couple problems: the wheels get off \_rotation if you move the mouse horizontaly…They are not parellel to the car, but rather , perpindicular. The reg point on both the wheels is in the center…if that helps. But i think this is an AS issue…how can i adjust for this?

#2: when the car does get to the mouse, it pivots back to it’s original position (from authoring time), rather than retaining the rotaional direction in which it was moving.

```auto
Mouse.addListener(sWheel);
Mouse.hide();
sWheel.onMouseMove = function() {
    driving = true;
    drive();
};
function drive() {
    if (driving) {
        van.onEnterFrame = function() {
            a = Math.atan2(dY, dX);
            deg = a*180/Math.PI;
            dX = _xmouse-van._x;
            dY = _ymouse-van._y;
            vx = dX*ease;
            vy = dY*ease;
            van._x += vx;
            van._y += vy;
            van._rotation = deg;
            steer();
        };
    }
}
function steer() {
    for (i=0; i<wheels.length; i++) {
        wheels*._rotation = deg;
    }
} 

```

thanks for your help
