Validate()
Repair the capsule so that it can be used.
阅读时间1 分钟最后更新于 23 天前
Definition
- Type: Method
- Namespace: Unity.U2D.Physics
- Assembly: UnityEngine.PhysicsCore2DModule
public readonly CapsuleGeometry Validate()
Returns
Type | Description |
|---|---|
| CapsuleGeometry | The repaired capsule. See CapsuleGeometry.isValid. |
Remarks
The radius is clamped to zero or greater. When the two centers are further apart than PhysicsWorld.minEdgeLength they are left as they are, otherwise both are replaced with the shortest axis that can still be used. That replacement keeps the direction between the two centers, or points up when they are identical, because a capsule with no length would behave as a circle instead. It does not preserve the original position: a capsule repaired this way is centered on the origin. A non-finite center or radius is not always repaired and can be returned unchanged, so check CapsuleGeometry.isValid when those values might not be finite.