Version: 2017.1
public float stiffness ;

描述

extremumValueasymptoteValue 值的乘数(默认值为 1)。

改变摩擦力的刚度。将此值设置为零 将完全禁用车轮的所有摩擦力。

通常在运行时修改 stiffness 来模拟各种地面材质。(例如,在草地上行驶时 降低刚度)。 另请参阅: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; } } }