WheelFrictionCurve.stiffness
Declaration
public float stiffness;Описание
Множитель для значений extremumValue и asymptoteValue (по умолчанию 1).
Изменяет жесткость трения. Установка этого на нуль полностью отключит все трение от колеса.
Обычно вы модифицируете stiffness, чтобы симулировать различные грунтовые материалы (e.g. уменьшить жесткость при езде на траве). Дополнительные ресурсы: WheelCollider.GetGroundHit.
using UnityEngine; using System.Collections;
public class ExampleClass : MonoBehaviour { public WheelCollider wheel;
void Start() { wheel = GetComponent<WheelCollider>(); }
// When attached to the WheelCollider, modifies tire friction based on // static friction of the ground material. void FixedUpdate() { WheelHit hit; if (wheel.GetGroundHit(out hit)) { WheelFrictionCurve fFriction = wheel.forwardFriction; fFriction.stiffness = hit.collider.material.staticFriction; wheel.forwardFriction = fFriction; WheelFrictionCurve sFriction = wheel.sidewaysFriction; sFriction.stiffness = hit.collider.material.staticFriction; wheel.sidewaysFriction = sFriction; } } }