PhysicsShape.ShapeProxy
A proxy of a shape in a generic form suited to representing all support shape types. You can provide between 1 and PhysicsConstants.MaxPolygonVertices and a radius. A CircleGeometry is a single point with a non-zero radius (zero radius is allowed however and defines a point). A CapsuleGeometry is two points with a non-zero radius. A PolygonGeometry box is the points with and an optional radius. A SegmentGeometry is two points with a zero radius. A ChainSegmentGeometry is two points with a zero radius. To create a proxy, simply provide the geometry to the constructor.
Read time 2 minutesLast updated 8 days ago
Definition
- Type: Struct
- Namespace: Unity.U2D.Physics
- Assembly: UnityEngine.PhysicsCore2DModule
public struct PhysicsShape.ShapeProxy
Constructors
Constructor | Description |
|---|---|
| ShapeProxy(Unity.U2D.Physics.CapsuleGeometry) | Create a shape proxy using the specified Capsule. |
| ShapeProxy(Unity.U2D.Physics.ChainSegmentGeometry) | Create a shape proxy using the specified ChainSegment. |
| ShapeProxy(Unity.U2D.Physics.CircleGeometry) | Create a shape proxy using the specified Circle. |
| ShapeProxy(Unity.U2D.Physics.PolygonGeometry) | Create a shape proxy using the specified Polygon. |
| ShapeProxy(Unity.U2D.Physics.SegmentGeometry) | Create a shape proxy using the specified Segment. |
| ShapeProxy(UnityEngine.Vector2) | Create a shape proxy representing a single point. |
Properties
Property | Description |
|---|---|
| aabb | Get the AABB that bounds the shape proxy. |
| capsuleGeometry | Get a CapsuleGeometry from the shape proxy. The _count must be 2. |
| circleGeometry | Get a CircleGeometry from the shape proxy. The _count must be 1. |
| count | The number of vertices. |
| isValid | Check if the shape proxy is valid. |
| polygonGeometry | Get a PolygonGeometry from the shape proxy. |
| radius | The radius around the vertices. |
| segmentGeometry | Get a SegmentGeometry from the shape proxy. The _count must be 2. |
| shapeType | The shape type represented. |
| vertices | The shape vertices. |
Methods
Method | Description |
|---|---|
| AsSpan | Get the convex-hull vertices as a span. |