CapsuleGeometry
The geometry of a closed capsule which can be viewed as two semi-circles connected by a rectangle. See PhysicsBody.CreateShape.
Read time 2 minutesLast updated 9 days ago
Definition
- Type: Struct
- Namespace: Unity.U2D.Physics
- Assembly: UnityEngine.PhysicsCore2DModule
- Implements: IEquatable<CapsuleGeometry>
public struct CapsuleGeometry : IEquatable<CapsuleGeometry>
Static Fields
Value | Description |
|---|---|
| defaultGeometry | Get the default Capsule. |
Constructors
Constructor | Description |
|---|---|
| CapsuleGeometry() | Create a default Capsule. See _defaultGeometry. |
Properties
Property | Description |
|---|---|
| areEdgesValid | Whether _center1 and _center2 are far enough apart to form a valid edge. |
| center1 | Local center of the first semi-circle. |
| center2 | Local center of the second semi-circle. |
| isValid | Whether the geometry describes a capsule that can be used. |
| radius | The radius of the semi-circles. |
Methods
Method | Description |
|---|---|
| CalculateAABB | Calculate the AABB of the geometry. |
| CalculateMassConfiguration | Calculate the mass configuration of the geometry. |
| CastRay | Calculate if a world ray intersects the geometry. See PhysicsQuery.CastResult. |
| CastShape | Calculate if a cast shape intersects the geometry. Initially touching shapes are treated as a miss. You should check for overlap first if initial overlap is required. See PhysicsQuery.CastShapeInput and PhysicsQuery.CastResult. |
| ClosestPoint | Calculate the closest point on this geometry to the specified point. |
| CreateShapeProxy | Create a shape proxy from the geometry. |
| Intersect | Check the intersection between this geometry and another. |
| InverseTransform | Inverse-Transform the geometry. |
| OverlapPoint | Calculate if a point overlaps the geometry. |
| ToPolygons | Creates multiple PolygonGeometry from the geometry. A limit is imposed on small vertex distances so it is recommended that the geometry is scaled appropriately rather than on the returned geometry so geometry is not discarded due to it being invalid. |
| Transform | Transform the geometry. |
| Validate | Repair the capsule so that it can be used. |
Static Methods
Method | Description |
|---|---|
| Create | Create a Capsule. |
| InverseTransform | Inverse-Transform a batch of geometry in place. |
| Transform | Transform a batch of geometry in place. |