Page 1 of 1

Wheel Spin in Vehicles

Posted: Mon May 30, 2011 2:49 am
by nizgtr
I'm using Bepu in my car game, and I noticed that there is no actual wheel spin heppening. Is there any way to achieve actual wheel spin?
ps, Amazing physics engine, great work!

Re: Wheel Spin in Vehicles

Posted: Mon May 30, 2011 3:05 am
by Norbo
Amazing physics engine, great work!
Thanks!
I'm using Bepu in my car game, and I noticed that there is no actual wheel spin heppening. Is there any way to achieve actual wheel spin?
It depends on what you mean by 'actual' wheel spin. The vehicle class is supported by ray casts, and the wheels are simply a visual approximation. If you mean you don't see them turning at all, then something is wrong- check the demos for an example of the proper behavior.

Basically, while in contact with the ground, a wheel's angular velocity is precisely controlled by the linear velocity at the ray cast hit location (except when braking with the wheel-freezing-while-braking turned on). Because of this, the wheels do not 'slip.' If the wheel leaves the ground, they continue rotating using the previous velocity which slows down over time. Powered wheels can still be spun while in the air.

If you want to simulate slipping in the wheels, you could change how the wheel angular velocity is calculated, possibly with additional information. Figuring out a good, consistent approach won't be trivial, but it is possible. Doing something hacky but simple like arbitrarily spinning the wheels faster at specific triggers might look fine. Making these modifications will require going into the vehicle's source.

Another option is to construct a vehicle from physical entities and constraints. Wheel slipping would naturally occur. However, tuning it could be a bit difficult, and it would take more time to simulate.

Re: Wheel Spin in Vehicles

Posted: Mon May 30, 2011 3:09 am
by nizgtr
Norbo wrote:
Amazing physics engine, great work!
Thanks!
I'm using Bepu in my car game, and I noticed that there is no actual wheel spin heppening. Is there any way to achieve actual wheel spin?
It depends on what you mean by 'actual' wheel spin. The vehicle class is supported by ray casts, and the wheels are simply a visual approximation. If you mean you don't see them turning at all, then something is wrong- check the demos for an example of the proper behavior.

Basically, while in contact with the ground, a wheel's angular velocity is precisely controlled by the linear velocity at the ray cast hit location (except when braking with the wheel-freezing-while-braking turned on). Because of this, the wheels do not 'slip.' If the wheel leaves the ground, they continue rotating using the previous velocity which slows down over time. Powered wheels can still be spun while in the air.

If you want to simulate slipping in the wheels, you could change how the wheel angular velocity is calculated, possibly with additional information. Figuring out a good, consistent approach won't be trivial, but it is possible. Doing something hacky but simple like arbitrarily spinning the wheels faster at specific triggers might look fine. Making these modifications will require going into the vehicle's source.

Another option is to construct a vehicle from physical entities and constraints. Wheel slipping would naturally occur. However, tuning it could be a bit difficult, and it would take more time to simulate.
Yes I ment wheel slippage when traction is overcome by the torque. I'm thinking of checking if the slippage is occuring and if it is calc the world transform accordingly.