Vehicle Wheelspin

I’m a little confused on how to apply a wheelspin effect for a vehicle. As it stands right now, the wheel rotates in accordance to the velocity of the vehicle itself. That is to say, if the vehicle is going slow, the wheel rotates slow. If the vehicle is moving fast, the vehicle rotates fast. The wheels themselves appear to have some kind of traction control.

I am trying to get the wheel to rotate in accordance to the force of the engine. For example, if the player floors the accelerator, the wheels will spin.

I am aware of the skidinfo to detect if a wheel is slipping or not, but i’m not sure how I can achieve the desired effect.

Any pointers would be greatly appreciated.

That should work as you say it, just tune the friction and acceleration force values. The wheels rotation is not based on the speed alone, its based on the computations of the raycast wheel. You might want to ramp the acceleration value based on the actual speed of the vehicle as the final velocity with high acceleration values might be too high.

Hi normen.

The actual physics of the car do reflect the desired effect. For example, if apply the following effects, the vehicle will slip as expected:

// before adding the wheels
vehicleControl. setFrictionSlip(0.8f);

// in action controller
vehicleControl.accelerate(2, 1000f);
vehicleControl.accelerate(3, 1000f);

So the vehicle will slip around as one would expect. This is perfect.

The problem is that the wheel itself does not rotate in reflection to the slip.

For example: If we are driving a rear-wheel drive porsche in real life. If - from a still position - I floor the vehicle, the rear wheels will spin, the friction of the rear wheels will be near-zero, the rear of the vehicle will slip around if you try to turn.

The slip effect I described does occur, and the skidinfo values show that the rear-wheels are slipping too. The problem I have is that the wheel is barely rotating in-game. The physics effects themselves are in effect - the vehicle is slipping - but the wheel is rotating in accordance to the velocity of the vehicle - and not the force of acceleration applied to the wheel - which is what I want.

I have a few algorithms in my head on how I can “connect” the engine RPM to the wheel, but I can’t see any method that allows me to set the wheel rotation. I guess a better way to ask my question is “which methods of the vehicle or wheel directly affect the speed of the wheel’s rotation.”

I’m sorry if I am confusing the situation, or if you already answered my question in your first answer - but i’ve been playing around with it over the past few days and can’t seem to get my head around it.

Same request here :slight_smile: I have same problem. Have you found a solution for this?