hi guys…doing an exercise with the mouse and some trig…i made this 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.
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