PolygonShape
Declaration
public class tainicom.Aether.Physics2D.Collision.Shapes.PolygonShape
Represents a simple non-selfintersecting convex polygon. Create a convex hull from the given array of points.
Inherits: tainicom.Aether.Physics2D.Collision.Shapes.Shape
Constructors
PolygonShape
Initializes a new instance of the PolygonShape class.
void PolygonShape(Vertices vertices, float density)
Parameters:
| Name | Type | Description |
|---|---|---|
vertices |
tainicom.Aether.Physics2D.Common.Vertices |
The vertices. |
density |
System.Single |
The density. |
PolygonShape
Create a new PolygonShape with the specified density.
void PolygonShape(float density)
Parameters:
| Name | Type | Description |
|---|---|---|
density |
System.Single |
The density. |
Properties
Vertices
Create a convex hull from the given array of local points. The number of vertices must be in the range [3, Settings.MaxPolygonVertices]. Warning: the points may be re-ordered, even if they form a convex polygon Warning: collinear points are handled but not removed. Collinear points may lead to poor stacking behavior.
Vertices Vertices { get set }
Normals
Vertices Normals { get }
ChildCount override
int ChildCount { get }
Methods
ComputeProperties protected override
void ComputeProperties()
TestPoint override
bool TestPoint(ref Transform transform, ref Vector2 point)
Parameters:
| Name | Type | Description |
|---|---|---|
transform |
ref tainicom.Aether.Physics2D.Common.Transform |
|
point |
ref Strawberry.Math.Vector2 |
RayCast override
bool RayCast(out RayCastOutput output, ref RayCastInput input, ref Transform transform, int childIndex)
Parameters:
| Name | Type | Description |
|---|---|---|
output |
out tainicom.Aether.Physics2D.Collision.RayCastOutput |
|
input |
ref tainicom.Aether.Physics2D.Collision.RayCastInput |
|
transform |
ref tainicom.Aether.Physics2D.Common.Transform |
|
childIndex |
System.Int32 |
ComputeAABB override
Given a transform, compute the associated axis aligned bounding box for a child shape.
void ComputeAABB(out AABB aabb, ref Transform transform, int childIndex)
Parameters:
| Name | Type | Description |
|---|---|---|
aabb |
out tainicom.Aether.Physics2D.Collision.AABB |
The aabb results. |
transform |
ref tainicom.Aether.Physics2D.Common.Transform |
The world transform of the shape. |
childIndex |
System.Int32 |
The child shape index. |
ComputeSubmergedArea override
float ComputeSubmergedArea(ref Vector2 normal, float offset, ref Transform xf, out Vector2 sc)
Parameters:
| Name | Type | Description |
|---|---|---|
normal |
ref Strawberry.Math.Vector2 |
|
offset |
System.Single |
|
xf |
ref tainicom.Aether.Physics2D.Common.Transform |
|
sc |
out Strawberry.Math.Vector2 |
CompareTo
bool CompareTo(PolygonShape shape)
Parameters:
| Name | Type | Description |
|---|---|---|
shape |
tainicom.Aether.Physics2D.Collision.Shapes.PolygonShape |
Clone override
Shape Clone()