I’m probably being dense but, I can’t seem to find how to change wheelcollider friction properties in code.
Using collider.forwardFriction.extremumSlip = X complains that forwardFriction is not a variable. Using it like a method complains it isn’t a method. I’ve searched through the manual and scripting reference and googled it dozens of times and I just can’t seem to figure out how to set the friction values.
Please point out the answer that is more than likely staring me in the face.
Thanks!
Doh, of course after spending hours trying to figure this out and finally posting, I discovered the answer moments later.
You can’t set individual properties, you have to create a WheelFrictionCurve variable, fill that in, then assign it to the wheelcollider forward or sideways friction. e.g.
WheelFrictionCurve wfcForward = new WheelFrictionCurve();
wfcForward.extremumSlip = 0.4f;
wfcForward.extremumValue = 5000f;
Then
myWheelCollider.forwardFriction = wfcForward;
2 Likes
OMG I LOVE YOU THANKS SO MUCH
Please don’t necro threads, simply hit the like button to show appreciation.
Will close this 8 year old thread now.