文档

Unity Engine

Unity Engine

bounceThreshold

The minimum approach speed, in meters per second, at which colliding objects bounce (default 2). Must be positive.
阅读时间1 分钟最后更新于 14 小时前

Definition

public static float bounceThreshold { get; set; }

Remarks

The physics system compares this value to the relative velocity of the two objects along the contact normal at the contact point. If the objects approach each other slower than this value, they don't bounce, regardless of the PhysicsMaterial.bounciness and PhysicsMaterial.bounceCombine values of their materials. Above the threshold, the rebound speed is approximately the approach speed multiplied by the combined bounciness.
The default value of 2 stops slow objects from bouncing. For example, pool balls that roll into a cushion at 0.5 meters per second stick to it instead of rebounding. To make slow objects bounce, lower the threshold, for example to 0.1. A low threshold can make resting objects jitter, because gravity gives a resting object a small approach speed in each physics step. To prevent this, use a combined bounciness of 0 for contacts with floors and other resting surfaces.
This value applies to all physics scenes. You can also change it in
Edit->Project Settings->Physics->Settings->GameObject
.

Examples

using UnityEngine;public class Example : MonoBehaviour{ void Start() { Physics.bounceThreshold = 1; }}