Shape
Declaration
public abstract class tainicom.Aether.Physics2D.Collision.Shapes.Shape
A shape is used for collision detection. You can create a shape however you like. Shapes used for simulation in World are created automatically when a Fixture is created. Shapes may encapsulate a one or more child shapes.
Constructors
Shape protected
void Shape(float density)
Parameters:
| Name | Type | Description |
|---|---|---|
density |
System.Single |
Properties
ShapeType
Get the type of this shape.
ShapeType ShapeType { get }
Value: The type of the shape.
ChildCount abstract
Get the number of child primitives.
int ChildCount { get }
Density
Gets or sets the density. Changing the density causes a recalculation of shape properties.
float Density { get set }
Value: The density.
Radius
Radius of the Shape Changing the radius causes a recalculation of shape properties.
float Radius { get set }
Fields
MassData
Contains the properties of the shape such as: - Area of the shape - Centroid - Inertia - Mass
MassData MassData
Methods
Clone abstract
Clone the concrete shape
Shape Clone()
Returns: A clone of the shape
TestPoint abstract
Test a point for containment in this shape. Note: This only works for convex shapes.
bool TestPoint(ref Transform transform, ref Vector2 point)
Parameters:
| Name | Type | Description |
|---|---|---|
transform |
ref tainicom.Aether.Physics2D.Common.Transform |
The shape world transform. |
point |
ref Strawberry.Math.Vector2 |
A point in world coordinates. |
Returns: True if the point is inside the shape
RayCast abstract
Cast a ray against a child shape.
bool RayCast(out RayCastOutput output, ref RayCastInput input, ref Transform transform, int childIndex)
Parameters:
| Name | Type | Description |
|---|---|---|
output |
out tainicom.Aether.Physics2D.Collision.RayCastOutput |
The ray-cast results. |
input |
ref tainicom.Aether.Physics2D.Collision.RayCastInput |
The ray-cast input parameters. |
transform |
ref tainicom.Aether.Physics2D.Common.Transform |
The transform to be applied to the shape. |
childIndex |
System.Int32 |
The child shape index. |
Returns: True if the ray-cast hits the shape
ComputeAABB abstract
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. |
ComputeProperties protected abstract
Compute the mass properties of this shape using its dimensions and density. The inertia tensor is computed about the local origin, not the centroid.
void ComputeProperties()
ComputeSubmergedArea abstract
Used for the buoyancy controller
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 |