Version: Unity 6.7 Beta (6000.7)
LanguageEnglish
  • C#

CapsuleGeometry.Validate

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Declaration

public CapsuleGeometry Validate();

Returns

CapsuleGeometry The repaired capsule. See CapsuleGeometry.isValid.

Description

Repair the capsule so that it can be used.

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.