Interface ICollider2D
Interface for a Collider Shape of 2D physics.
Namespace: Evergine.Common.Physics2D
Assembly: Evergine.Common.dll
Syntax
public interface ICollider2D
Properties
CollisionCategories
Gets or sets the collision category bits.
Declaration
ColliderCategory2D CollisionCategories { get; set; }
Property Value
| Type | Description |
|---|---|
| ColliderCategory2D |
Density
Gets or sets the density, usually in kg/m^2.
Declaration
float Density { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
Friction
Gets or sets the friction coefficient, usually in the range [0,1].
Declaration
float Friction { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
GroupIndex
Gets or sets the collision groups allow a certain group of objects to never collide (negative) or always collide (positive).
Declaration
short GroupIndex { get; set; }
Property Value
| Type | Description |
|---|---|
| short |
InternalCollider
Gets the internal Box2D fixture instance.
Declaration
object InternalCollider { get; }
Property Value
| Type | Description |
|---|---|
| object |
IsSensor
Gets or sets a value indicating whether this sensor shape collects contact information but never generates a collision response.
Declaration
bool IsSensor { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
MaskBits
Gets or sets the collision mask bits.
Declaration
ColliderCategory2D MaskBits { get; set; }
Property Value
| Type | Description |
|---|---|
| ColliderCategory2D |
Restitution
Gets or sets the restitution (elasticity) usually in the range [0,1].
Declaration
float Restitution { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
RigidBody
Gets the parent body of this collider.
Declaration
IRigidBody2D RigidBody { get; }
Property Value
| Type | Description |
|---|---|
| IRigidBody2D |
Shape
Gets the Collider shape.
Declaration
IColliderShape2D Shape { get; }
Property Value
| Type | Description |
|---|---|
| IColliderShape2D |
UserData
Gets or sets the object user data.
Declaration
object UserData { get; set; }
Property Value
| Type | Description |
|---|---|
| object |
Methods
ComputeDistance(ref Vector2, ref Vector2, float, out float, out Vector2)
Compute the distance from the current shape to the specified point. This only works for convex shapes.
Declaration
void ComputeDistance(ref Vector2 point, ref Vector2 shapePosition, float shapeAngle, out float distance, out Vector2 normal)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector2 | point | a point in world coordinates. |
| Vector2 | shapePosition | the shape world position. |
| float | shapeAngle | the shape world angle. |
| float | distance | the distance from the current shape. |
| Vector2 | normal | the direction in which the distance increases. |
Events
BeginCollision
Called when two fixtures begin to touch.
Declaration
event ContactDelegate BeginCollision
Event Type
| Type | Description |
|---|---|
| ContactDelegate |
EndCollision
Called when two fixtures cease to touch.
Declaration
event ContactDelegate EndCollision
Event Type
| Type | Description |
|---|---|
| ContactDelegate |