Archived

This topic is now archived and is closed to further replies.

Accelerating and Rotating

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

Recommended Posts

Hi, I have a simple car that can speed up, slow down and turn left and right. I don''t know how to handle with incorrect rotation when I increase the velocity. When I speed up the radius of the circle that the car is moving along start to increase. I calculate the new position of the car with: position.x += (float)(velocity.x*cos(DEG2RAD(yRot))); position.z += (float)((-velocity.z)*(sin(DEG2RAD(yRot)))); glTranslatef(position.x, 0.0f, position.z); glRotatef(yRot, 0.0f, 1.0f, 0.0f); I would be grateful for any replies. Regards!

Share on other sites
Isn''t that what''s supposed to happen?

Share on other sites
myeh... if your rotational velocity is constant, when your car speeds up its gonna go in larger circles... if you wanna have the same circle radius then you have to make your rotational velocity proportional to the speed of the car...

Share on other sites
Thanks for all relpies.

I thought that something was wrong because it looks a little bit abnormal. But I guess, if the whole car physics was added, it would look much better.

Share on other sites
you may want to limit how fast the car is turning, or its linear velocity, depending on the car grip.

Generaly, the acceleration the car can take is in relation with the force acting down on the car, meaning, the gravity.

so acceleration shouls always be < gravity * grip.

in your case, V = r.W (linear velocity equal radius of turn times angular velocity). So, if the velocity increases, and the angular velocity stays the same, the radius will increase.

so,
V = r.W
amax = Vmax² / r

=> amax = W².r
=> r = amax / W²
so

Vmax = amax . W
Vmax = (gravity . grip).W

you turn at constant speed, the maximum linear velocity the car can take is then amax . W, so you can limit the velocity of the car that way.

equaly, Wmax = V / amax, so you can also limit the truning radius of the car like that. you can use the exceedent and play a skidding sound or something.

also, the radius of turn in the case the car is coasting around a circle in a constant linear and angular velocity is

r = wheelbase / sin(steering_angle)

for example, you can therefore calculate the minimum turning radius, using the maximum steering_angle. wheelbase = 3 meters, mas angle = 30 degrees, turning radius = 6 meters.

Share on other sites
Hi,

thanks for yor explanation but I''m not sure if I understand everything.

amax - is the maximum acceleration ?
W - is the angle ? In my case yRot, right ??

Share on other sites
No, W is angular velocity.

1. 1
2. 2
Rutin
25
3. 3
4. 4
5. 5

• 11
• 10
• 13
• 20
• 14
• Forum Statistics

• Total Topics
632950
• Total Posts
3009377
• Who's Online (See full list)

There are no registered users currently online

×