Wheel Collider 车轮碰撞器
The Wheel Collider is a special collider for grounded vehicles. It has built-in collision detection, wheel physics, and a slip-based tire friction model. It can be used for objects other than wheels, but it is specifically designed for vehicles with wheels.
菜单位置:Component » Physics » Wheel Colider
车轮碰撞器是一个特殊的地面车辆碰撞器。它具有内置的碰撞检测、车轮物理引擎和一个基于滑移的轮胎摩擦模型。当然,它也可以用于其他对象,但它是专门为有轮子的车辆设计。
Properties 属性
- Center 中心 Center of the wheel in object local space.
车轮在对象自身坐标的中心位置 - Radius 半径 Radius of the wheel. 车轮的半径大小
- Suspension Distance 悬挂距离 Maximum extension distance of wheel suspension, measured in local space. Suspension always extends downwards through the local Y-axis.
最大车轮悬挂伸缩距离,以自身坐标计算。悬挂总是通过自身Y轴伸展向下。 - Suspension Spring 悬挂弹簧 The suspension attempts to reach a Target Position by adding spring and damping forces.
通过添加弹簧和阻尼力,悬挂试图达到目标位置(Target Position)。 - Spring 弹簧 Spring force attempts to reach the Target Position. A larger value makes the suspension reach the Target Position faster.
弹簧力尝试达到目标位置(Target Position),大的值可使悬挂快速达到目标位置(Target Position)。 - Damper 阻尼器 Dampens the suspension velocity. A larger value makes the Suspension Spring move slower.
阻尼器控制悬挂速度,大的值可使悬挂弹簧移动变慢。 - Target Position 目标位置 The suspension's rest distance along Suspension Distance. 0 maps to fully extended suspension, and 1 maps to fully compressed suspension. Default value is zero, which matches the behavior of a regular car's suspension.
悬挂的静止状态距离沿着悬挂距离,0值充分伸展悬挂,1值充分压缩悬挂,默认值为0,这是一个标准的汽车悬挂行为 - Mass 质量 The Mass of the wheel. 车轮的质量
- Forward/Sideways Friction
向前摩擦力 Properties of tire friction when the wheel is rolling forward and sideways. See Wheel Friction Curves section below.
当车轮向前/侧向滚动时的摩擦力属性。参见下面车轮摩擦力曲线部分。
Details 详细
The wheel's collision detection is performed by casting a ray from Center downwards through the local Y-axis. The wheel has a Radius and can extend downwards according to the Suspension Distance. The vehicle is controlled from scripting using different properties: motorTorque, brakeTorque and steerAngle. See the Wheel Collider scripting reference for more information.
车轮的碰撞检测。通过自身Y轴的中心向下,投射一条射线。车轮有一个半径并可向下延伸,相对于悬挂距离。车轮从脚本使用不同的属性控制:motorTorque(动力力矩),brakeTorque(制动力矩)和steerAngle(转向角)。参见车轮碰撞器脚本参考,查看更多信息。
The Wheel Collider computes friction separately from the rest of physics engine, using a slip-based friction model. This allows for more realistic behaviour but also causes Wheel Colliders to ignore standard Physic Material settings.
车轮碰撞器从物理引擎静止分开计算摩擦力,使用基于滑动摩擦力模型。这将得到更真实的行为,但也导致车轮碰撞器忽略标准的物理学材质设置。
Wheel collider setup 车轮碰撞器设置
You do not turn or roll WheelCollider objects to control the car - the objects that have WheelCollider attached should always be fixed relative to the car itself. However, you might want to turn and roll the graphical wheel representations. The best way to do this is to setup separate objects for Wheel Colliders and visible wheels:
不转或滚WheelCollider物体来控制轿车,附加WheelCollider的物体应始终相对轿车自身固定。但是,你可能想要转或滚图形轮。要做到这一点的最好办法是分别设置物体的碰撞器和可见的车轮。
Wheel Colliders are separate from visible Wheel Models
车轮碰撞器从可见的车轮模型分开。
Collision geometry 碰撞器几何结构
Because cars can achieve large velocities, getting race track collision geometry right is very important. Specifically, the collision mesh should not have small bumps or dents that make up the visible models (e.g. fence poles). Usually a collision mesh for the race track is made separately from the visible mesh, making the collision mesh as smooth as possible. It also should not have thin objects - if you have a thin track border, make it wider in a collision mesh (or completely remove the other side if the car can never go there).
因为车辆能实现比较大的速度,创建比较合理的碰撞几何结构比较重要。具体来说,赛道(collision mesh)碰撞网格,不应该有小的凹凸不平,通常赛道的网格可见网格分开来制作。在弯道设计的时候有点要注意,由于离心力的影响,弯道外侧要比内侧高一些,这样做使车辆更容易转弯。
Visible geometry (left) is much more complex than collision geometry (right)
可见几何模型(左)比碰撞几何模型(右)复杂的多。
Wheel Friction Curves 车轮的摩擦力曲线
Tire friction can be described by the Wheel Friction Curve shown below. There are separate curves for the wheel's forward (rolling) direction and sideways direction. In both directions it is first determined how much the tire is slipping (based on the speed difference between the tire's rubber and the road). Then this slip value is used to find out tire force exerted on the contact point.
轮胎摩擦力由下图的车轮摩擦力曲线描述。车轮向前方向(滚动方向)和侧面方向有单独的曲线。在两个方向上,首先确定多少轮胎滑动(在轮胎橡胶和路面之间,基于不同的速度)。然后,slip值用来找出施加到接触点轮胎力。
The curve takes a measure of tire slip as an input and gives a force as output. The curve is approximated by a two-piece spline. The first section goes from (0 , 0) to (ExtremumSlip , ExtremumValue), at which point the curve's tangent is zero. The second section goes from (ExtremumSlip , ExtremumValue) to (AsymptoteSlip , AsymptoteValue), where curve's tangent is again zero:
该曲线使用轮胎滑移作为输入并输出一个力。该曲线近似由两段曲线构成。第一段从(0,0)到(extremumSlip, extremumValue)到(asymptoteSlip, asymptoteValue),这里曲线的切线再次为零。
车轮模型可分解为横向(侧面)和纵向(滚动方向)。对于每一种方向而言,均存在一种曲线,能够显示车轮和地面间的滑度与所形成的力度之间的关联情况。这种曲线与下图中的曲线较为相似:
Typical shape of a wheel friction curve
车轮摩擦力曲线图
The property of real tires is that for low slip they can exert high forces, since the rubber compensates for the slip by stretching. Later when the slip gets really high, the forces are reduced as the tire starts to slide or spin. Thus, tire friction curves have a shape like in the image above.
真实的轮胎属性是较慢的滑动将获得较高的力因为橡胶通过拉伸补偿滑动,然后当滑动变的较高时,这个力被减小因为轮胎开始滑动或旋转。因此轮胎摩擦力曲线具有上图所示的形状。
在横向上,Slip Angle(滑角)被用作输入,而在纵向上,Slip Ratio(滑率)被用作输入。您指定这些曲线的方式是提供本示意图所示两点的坐标,参照为"Extremum(极值)"和"Asymtote(渐近线)"。Extremum(极值)指的是最大外力的点位,而Asymtote(渐近线)点位提供了无限滑动时的输出值。每个点位处的切线均视为平滑,然后在它们之间放置一个立体样条,从而确定曲线的最终形状。
- Extremum Slip/Value 极值 Curve's extremum point. 曲线的极值点。
- Asymptote Slip/Value 渐近线值 Curve's asymptote point. 曲线的渐近线点。
- Stiffness 刚度 Multiplier for the Extremum Value and Asymptote Value (default is 1). Changes the stiffness of the friction. Setting this to zero will completely disable all friction from the wheel. Usually you modify stiffness at runtime to simulate various ground materials from scripting.
极值和渐近线值倍增默认为1。改变摩擦的刚度。设置这个参数为0,将完全禁用车辆的所有摩擦力。通常你在运行时修改脚本来模拟各种地面材质的刚度。
Hints 提示
- You might want to decrease physics timestep length in Time Manager to get more stable car physics, especially if it's a racing car that can achieve high velocities.
您可能想要在时间管理器上减少在的物理时间步长,得到更稳定的赛车的物理, 特别是如果一辆赛车,可以达到很高的速度。 - To keep a car from flipping over too easily you can lower its Rigidbody center of mass a bit from script, and apply "down pressure" force that depends on car velocity.
为了防止汽车太容易翻过来,可以从脚本降低它的刚体质量中心,并应用“下压”的力,这取决于车辆的速度。