Class Shape
- Namespace
- Alis.Core.Physic.Collision.Shapes
- Assembly
- Alis.dll
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.
public abstract class Shape
Inheritance
Derived
Inherited Members
Constructors
Shape(float)
Initializes a new instance of the Alis.Core.Physic.Collision.Shapes.Shape class
protected Shape(float density)
Parameters
density
float-
The density
Fields
MassData
Contains the properties of the shape such as:
- Area of the shape
- Centroid
- Inertia
- Mass
public MassData MassData
Field Value
_2radius
The 2radius
internal float _2radius
Field Value
_density
The density
internal float _density
Field Value
_radius
The radius
internal float _radius
Field Value
Properties
ChildCount
Get the number of child primitives.
public abstract int ChildCount { get; }
Property Value
Density
Gets or sets the density. Changing the density causes a recalculation of shape properties.
public float Density { get; set; }
Property Value
Radius
Radius of the Shape Changing the radius causes a recalculation of shape properties.
public float Radius { get; set; }
Property Value
ShapeType
Get the type of this shape.
public ShapeType ShapeType { get; internal set; }
Property Value
Methods
Clone()
Clone the concrete shape
public abstract Shape Clone()
Returns
- Shape
-
A clone of the shape
ComputeAABB(out AABB, ref Transform, int)
Given a transform, compute the associated axis aligned bounding box for a child shape.
public abstract void ComputeAABB(out AABB aabb, ref Transform transform, int childIndex)
Parameters
aabb
AABB-
The aabb results.
transform
Transform-
The world transform of the shape.
childIndex
int-
The child shape index.
ComputeProperties()
Compute the mass properties of this shape using its dimensions and density. The inertia tensor is computed about the local origin, not the centroid.
protected abstract void ComputeProperties()
ComputeSubmergedArea(ref Vector2, float, ref Transform, out Vector2)
Used for the buoyancy controller
public abstract float ComputeSubmergedArea(ref Vector2 normal, float offset, ref Transform xf, out Vector2 sc)
Parameters
Returns
RayCast(out RayCastOutput, ref RayCastInput, ref Transform, int)
Cast a ray against a child shape.
public abstract bool RayCast(out RayCastOutput output, ref RayCastInput input, ref Transform transform, int childIndex)
Parameters
output
RayCastOutput-
The ray-cast results.
input
RayCastInput-
The ray-cast input parameters.
transform
Transform-
The transform to be applied to the shape.
childIndex
int-
The child shape index.
Returns
- bool
-
True if the ray-cast hits the shape
TestPoint(ref Transform, ref Vector2)
Test a point for containment in this shape. Note: This only works for convex shapes.
public abstract bool TestPoint(ref Transform transform, ref Vector2 point)
Parameters
Returns
- bool
-
True if the point is inside the shape