Wheelcollider strange rpm behavior at certain speed.

Hello.

I’m new to wheelcolliders, so chances are I’ve made some simple mistake. So, I’ve set up a basic car using the unity tutorial, then modified some values of wheelcolliders. Generally speaking everything works fine, but when the car hits ~5-6m/s, the rpm of the wheel starts to behave kinda strange. If you take a look at the screenshot, you’ll see that wheels’ rpm jumps around ~100-230 with no motorTorque or steering applied. Once it’s out of ~5-6ms (or ~90-140rpm) range everything is fine again.

What could be the reason of this?

Thanks.

3073626--231131--rpm 3.jpg

show us your code, or look at my simple controller for guidance (in sig).

Its likely when the wheel is not on the ground, allowing it to spin freely.

Best solution I found was to set motortorque to zero if rpm exceeds a defined value.

if(Mathf.abs(wheel.rpm) > 150))
 wheel.motorTorque = 0;

The code is basically almost identical to what unity tutorial prodives.
The surface is a plane, so I believe that wheels stay at the ground all the time. Also, as I stated in OP motorTorque is 0, so it shouldn’t be the problem anyway.

The problem arises only within certain rpm/speed range, it works just as intended otherwise.

3075163–231368–CarController.cs (1.75 KB)

What is your wheel mass?

What is your main rb mass?

Setting motorTorque to zero is not going to remove existing forces. It just means youre not applying more force. Hence, the wheel leaving the ground with existing forces may result in spikes.

If I recall correctly it should be 40kg wheel to 3500kg rb.

Again, I doubt that wheel is leaving the ground since the whole surface is flat (plane), and the effect only happens within a specific speed range. Though it could be the reason, so I’ll check for “isGrounded” once I’m back at home.

I can provide the whole source project if it makes things easier, too.

Ok, so I checked for isGrounded. Turns out its grounded at all times.

I also took another screenshot to inllustrate the problem better. It’s divided into three parts: below the specific speed range (left), within the specific speed range (middle), above specific speed range (right).

Only other thing I can think of is its slipping