How to change the wheel.forwardFriction.stiffness value?

Hello! I want to change the wheelCollider.forwardFriction.stiffness in a script, but I’m not getting it. How do I modify wheelCollider.forwardFriction.stiffness in a script? Please help me.

Just like you change any field of a struct that is provided through a property:

  • You store the struct value in a temporary variable
  • You change the field you’re interested in on that temporary variable
  • You assign the temp variable back to the property

In code:

WheelFrictionCurve friction = wheelCollider.forwardFriction;
friction.stiffness = yourDesiredValue;
wheelCollider.forwardFriction = friction;