Page 1 of 1

Wheel / motor intertia

Posted: Wed Feb 23, 2011 11:04 pm
by preen
The car works really good, but there's a feature I miss from Jitter, wheel intertia. Using high values, it resists the wheel changing speed rapidly, and you can use it as a cheat to regulate a vehicle's acceleration to low values, even when using a high torque. Imagine the wheel is a concrete block, and forces applied to it only change the speed slowly. When reaching a hill, the car coasts up it, as the wheel's momentum is consumed. When going down a hill, the car hesitates to accelerate, as the wheels gradually speed up again.

In Bepu, when I apply a large drive force, the car picks up speed almost instantly. If I reduce the drive force, the car accelerates more realistically, but then it can't climb a shallow hill. I vary the drive force based on gear or speed, but even then, the car picks up too much speed going -down- the hill (exhibiting behavior like a toy car). As if the car's wheels and drive train have no inertia resisting changes in velocity.

I'm probably not explaining it right, but I suggest a mechanism in the wheel or motor that resists accelerations and stores momentum, such that a vehicle accelerates more slowly, and coasts up and down slopes.

Re: Wheel / motor intertia

Posted: Thu Feb 24, 2011 12:36 am
by Norbo
I suggest a mechanism in the wheel or motor that resists accelerations and stores momentum, such that a vehicle accelerates more slowly, and coasts up and down slopes.
I'm not sure how that differs from how the body's inertia behaves. The wheels in a real car have a negligible contribution to the total momentum of a moving vehicle; the thing that makes it coast up a hill is the inertia of the whole car. Increasing the mass of the body reduces acceleration given the same force; decreasing the force while keeping the mass the same decreases the acceleration. The vehicle will coast up and down slopes, so long as there isn't significant friction opposing it.

In the TankInput, the rolling friction is very high. This will stop the tank very quickly if the drive motor isn't trying to move. In the regular VehicleInput, the car will coast up and down hills for quite a while since its rolling friction is very low.

The Vehicle class is made to intentionally avoid dealing with specific complexities like wheel inertia due to their relatively tiny impact on the simulation. It is possible to construct a constraint-based vehicle with physical wheels that have inertia, but it tends to behave very similarly (an example can be found in this thread: http://www.bepu-games.com/forums/viewto ... 16&start=0).
In Bepu, when I apply a large drive force, the car picks up speed almost instantly. If I reduce the drive force, the car accelerates more realistically, but then it can't climb a shallow hill. I vary the drive force based on gear or speed, but even then, the car picks up too much speed going -down- the hill (exhibiting behavior like a toy car).
Those results are expected. Going down a hill will accelerate faster, and can produce velocities greater than the target speed due to gravity helping out. The drive motor will not attempt to slow down the vehicle if it happens to be coasting faster than its target speed. In such situations, the motor's applied impulse will likely be close to zero.

The driving motor can be controlled using both target speed and maximum force. With a high maximum force, it's akin to putting the pedal to the metal and accelerating from 0 to 60 (or whatever the target speed is) as fast as possible. Controlling and tuning the maximum force may be a more 'physical' way of looking at it, but you can also change the target speed however you see fit.

I should also note that the Vehicle is going open source soon :)