# Car Physics - Steering

This topic is 2951 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hello all.

First, i would like to apologize for my bad English.

I am having troubles with the Marco monster's cars physics tutorial.
http://regedit.gamedev.pl/Mirror/Car%20Physics%20for%20Games/Car%20Physics%20for%20Games.html

I am on the Steering at low speed part.

I cannot get the good equation and i don't understand where the problem is.

Basically, to move my car in a direction in degrees, with a speed value, i use this function :

this.car.x += speed * Math.cos((this.car.rotation) * PI / 180);this.car.y += speed * Math.sin((this.car.rotation) * PI / 180);

This, is working great, i can move my car in any direction from 0 to 360 degrees with a speed value.

Then i try to know the angular Velocity by following the tutorial and get stuck with something.

Here is how i proceed.

First i want to get the Radius of the circle given by the wheels projection triangle.

//==============================================================================//  GET RADIUS		//==============================================================================private function getRadius(L:Number, aDelta:Number):Number {   var R:Number = L / Math.sin(aDelta);   return Math.abs(R);}

so here, L is the wheel base, wich is equal to 110 pixels.
And my steering angle is 25;

so

var R:Number = getRadius(110, 25); // i get 831.11 pixels//thenvar angularVelocity:Number = 2 / R;//then angular velocity converted to degrees.angularVelocityD = 180 * (angularVelocity) / PI;this.car.rotation += angularVelocityD;this.car.x += 2 * Math.cos((this.car.rotation) * PI / 180);this.car.y += 2 * Math.sin((this.car.rotation) * PI / 180);

But, this doesn't work.
I know that the angular velocity is in Radian so because my car move with degrees i am pretty sure that i need to convert the value in degrees, but i may be wrong.

Any help would be greatly appreciated.
Thank you very much.

##### Share on other sites
I am pretty sure that Math.sin() takes an angle in radians so 25°
is no valid input for getRadius as this has to be convertet to radians.

##### Share on other sites
Hello Synacker.

Yes, you are right, i notice that after some time.

I think i finally make it works !
My car turn now properly at low speed.

I don't have time right now, but i will post the final code as soon as possible for people who are interested in it.

Regards.

##### Share on other sites
Please post, it will be very useful for me!

1. 1
2. 2
JoeJ
20
3. 3
frob
20
4. 4
5. 5

• 10
• 11
• 12
• 13
• 9
• ### Forum Statistics

• Total Topics
632210
• Total Posts
3004796

×