Interface ISimulation2D
Interface for Simulation2D.
Inherited Members
Namespace: Evergine.Common.Physics2D
Assembly: Evergine.Common.dll
Syntax
public interface ISimulation2D : IPausable, IDisposable
Properties
AllowSleeping
Gets or sets a value indicating whether allow sleeping.
Declaration
bool AllowSleeping { get; set; }
Property Value
Type | Description |
---|---|
bool |
CollisionList
Gets the colllision list.
Declaration
IEnumerable<ICollisionInfo2D> CollisionList { get; }
Property Value
Type | Description |
---|---|
IEnumerable<ICollisionInfo2D> |
DrawFlags
Gets or sets the debug draw flags.
Declaration
DebugDrawFlags DrawFlags { get; set; }
Property Value
Type | Description |
---|---|
DebugDrawFlags |
Gravity
Gets or sets the global gravity vector.
Declaration
Vector2 Gravity { get; set; }
Property Value
Type | Description |
---|---|
Vector2 |
InternWorld
Gets the internal native world instance.
Declaration
object InternWorld { get; }
Property Value
Type | Description |
---|---|
object |
IsLocked
Gets a value indicating whether the world is locked (in the middle of a time step).
Declaration
bool IsLocked { get; }
Property Value
Type | Description |
---|---|
bool |
PositionIterations
Gets or sets the position iterations.
Declaration
int PositionIterations { get; set; }
Property Value
Type | Description |
---|---|
int |
VelocityIterations
Gets or sets the velocity iterations.
Declaration
int VelocityIterations { get; set; }
Property Value
Type | Description |
---|---|
int |
WorldScale
Gets or sets the world scale.
Declaration
float WorldScale { get; set; }
Property Value
Type | Description |
---|---|
float |
WorldStaticBody
Gets the world static body.
Declaration
IRigidBody2D WorldStaticBody { get; }
Property Value
Type | Description |
---|---|
IRigidBody2D |
Methods
CreateColliderShape<T>()
Instantiate a new Collider shape.
Declaration
T CreateColliderShape<T>() where T : IColliderShape2D
Returns
Type | Description |
---|---|
T | The new collider shape. |
Type Parameters
Name | Description |
---|---|
T | The ColliderShape type. |
CreateJoint<T, J>(J)
Creates a Joint.
Declaration
T CreateJoint<T, J>(J jointDef) where T : IJoint2D where J : JointDef2D<T>
Parameters
Type | Name | Description |
---|---|---|
J | jointDef | The joint definition instance. |
Returns
Type | Description |
---|---|
T | The new joint instance. |
Type Parameters
Name | Description |
---|---|
T | The Joint type. |
J | The Joint definition type. |
CreateRigidBody(RigidBodyDef2D)
Creates a RigidBody 2D.
Declaration
IRigidBody2D CreateRigidBody(RigidBodyDef2D bodyDef)
Parameters
Type | Name | Description |
---|---|---|
RigidBodyDef2D | bodyDef | Body definition. |
Returns
Type | Description |
---|---|
IRigidBody2D | The rigid body instance. |
DebugDraw()
Draw the debug information.
Declaration
void DebugDraw()
RemoveJoint(IJoint2D)
Remove the joint from the physic world.
Declaration
void RemoveJoint(IJoint2D joint)
Parameters
Type | Name | Description |
---|---|---|
IJoint2D | joint | The joint to remove. |
RemoveRigidBody(IRigidBody2D)
Removes a RigidBody 2D from the world.
Declaration
void RemoveRigidBody(IRigidBody2D body)
Parameters
Type | Name | Description |
---|---|---|
IRigidBody2D | body | The body to remove. |
SetDebugDraw(ISimulationDebugDraw2D)
Sets the debug draw of Simulation 2D.
Declaration
void SetDebugDraw(ISimulationDebugDraw2D debugDraw)
Parameters
Type | Name | Description |
---|---|---|
ISimulationDebugDraw2D | debugDraw | The deubg draw instance. |
Step(TimeSpan)
Take a time step. This performs collision detection, integration, and constraint solution.
Declaration
void Step(TimeSpan gameTime)
Parameters
Type | Name | Description |
---|---|---|
TimeSpan | gameTime | the amount of time to simulate, this should not vary. |
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 |
OnPhysicStep
Event fired when the physics will do an step
Declaration
event EventHandler OnPhysicStep
Event Type
Type | Description |
---|---|
EventHandler |