Class BulletPhysicManager3D
The Simulation3D class manages all 3D physics entities.
Inheritance
Implements
Inherited Members
Namespace: Evergine.Bullet
Assembly: Evergine.Bullet.dll
Syntax
public class BulletPhysicManager3D : PhysicManager3D, IDependencyObject
Constructors
BulletPhysicManager3D()
Initializes a new instance of the BulletPhysicManager3D class.
Declaration
public BulletPhysicManager3D()
Fields
ExecutionState
Gets or sets the execution state.
Declaration
public ExecutionState ExecutionState
Field Value
| Type | Description |
|---|---|
| ExecutionState |
Properties
ApplySpeculativeContactRestitution
Gets or sets a value indicating whether to apply speculative contact restitution.
Declaration
public override bool ApplySpeculativeContactRestitution { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
Overrides
BulletDebugDraw
Gets the instance that is responsible to draw debug physic lines.
Declaration
public BulletDebugDraw3D BulletDebugDraw { get; }
Property Value
| Type | Description |
|---|---|
| BulletDebugDraw3D |
DrawFlags
Gets or sets the debug draw flags.
Declaration
public override DebugDrawFlags DrawFlags { get; set; }
Property Value
| Type | Description |
|---|---|
| DebugDrawFlags |
Overrides
FixedTimeStep
Gets or sets the resolution of the physics simulation. The default value is 1/60, or 60fps.
Declaration
public override float FixedTimeStep { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
Overrides
Gravity
Gets or sets the global gravity vector.
Declaration
public override Vector3 Gravity { get; set; }
Property Value
| Type | Description |
|---|---|
| Vector3 |
Overrides
InternalWorld
Gets the internal native world instance.
Declaration
public override object InternalWorld { get; }
Property Value
| Type | Description |
|---|---|
| object |
Overrides
MaxSubSteps
Gets or sets the maximum number of substeps that Physics3D is allowed to perform each step.
Declaration
public override int MaxSubSteps { get; set; }
Property Value
| Type | Description |
|---|---|
| int |
Overrides
PhysicWorldResolution
Gets or sets the resolution of the physics world. Changing this value does not affect the size or positions of Evergine entities. It only affects the internal physics world.
Declaration
public override float PhysicWorldResolution { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
Overrides
Methods
AddPhysicBody(IPhysicBody3D)
Adds the physics body to the simulation world.
Declaration
public override void AddPhysicBody(IPhysicBody3D body)
Parameters
| Type | Name | Description |
|---|---|---|
| IPhysicBody3D | body | The body. |
Overrides
ContactPairTest(IPhysicBody3D, IPhysicBody3D, IColliderShape3D, IColliderShape3D, ICollection<ContactPoint3D>)
The contact test query performs a collision test against the specified physics object.
Declaration
public override int ContactPairTest(IPhysicBody3D physicBodyA, IPhysicBody3D physicBodyB, IColliderShape3D colliderShapeA, IColliderShape3D colliderShapeB, ICollection<ContactPoint3D> contactPointCollection)
Parameters
| Type | Name | Description |
|---|---|---|
| IPhysicBody3D | physicBodyA | The first physics body to detect contact. |
| IPhysicBody3D | physicBodyB | The second physics body to detect contact. |
| IColliderShape3D | colliderShapeA | The collider on body A to test. |
| IColliderShape3D | colliderShapeB | The collider on body B to test. |
| ICollection<ContactPoint3D> | contactPointCollection |
Returns
| Type | Description |
|---|---|
| int | The number of contacts detected. |
Overrides
ContactTest(IPhysicBody3D, IColliderShape3D, ICollection<ContactPoint3D>)
The contact test query performs a collision test against all overlapping objects in the physics world.
Declaration
public override int ContactTest(IPhysicBody3D physicBody, IColliderShape3D colliderShape, ICollection<ContactPoint3D> contactPointCollection)
Parameters
| Type | Name | Description |
|---|---|---|
| IPhysicBody3D | physicBody | The physics body to detect contact. |
| IColliderShape3D | colliderShape | |
| ICollection<ContactPoint3D> | contactPointCollection |
Returns
| Type | Description |
|---|---|
| int | The number of contacts detected. |
Overrides
Remarks
resultsOutput is not cleared.
ConvexSweepTest(IColliderShape3D, ref Matrix4x4, ref Matrix4x4, CollisionCategory3D)
Performs a sweep test using a collider shape and stops at the first hit.
Declaration
public override HitResult3D ConvexSweepTest(IColliderShape3D colliderShape, ref Matrix4x4 from, ref Matrix4x4 to, CollisionCategory3D filterMask = CollisionCategory3D.All)
Parameters
| Type | Name | Description |
|---|---|---|
| IColliderShape3D | colliderShape | The collider shape. |
| Matrix4x4 | from | The starting matrix. |
| Matrix4x4 | to | The ending matrix. |
| CollisionCategory3D | filterMask | The collision category filter for the ray. |
Returns
| Type | Description |
|---|---|
| HitResult3D | The result of the hit. |
Overrides
ConvexSweepTestAll(IColliderShape3D, ref Matrix4x4, ref Matrix4x4, ICollection<HitResult3D>, CollisionCategory3D)
Sweep test using a collider shape that stops at the first hit.
Declaration
public override void ConvexSweepTestAll(IColliderShape3D colliderShape, ref Matrix4x4 from, ref Matrix4x4 to, ICollection<HitResult3D> resultsOutput, CollisionCategory3D filterMask = CollisionCategory3D.All)
Parameters
| Type | Name | Description |
|---|---|---|
| IColliderShape3D | colliderShape | The collider shape. |
| Matrix4x4 | from | The initial matrix. |
| Matrix4x4 | to | The target matrix. |
| ICollection<HitResult3D> | resultsOutput | The collection where the contact results will be included. |
| CollisionCategory3D | filterMask | The collision category that the ray will hit. |
Overrides
CreateColliderShape<T>(params object[])
Instantiates a new Collider shape.
Declaration
public override T CreateColliderShape<T>(params object[] param) where T : IColliderShape3D
Parameters
| Type | Name | Description |
|---|---|---|
| object[] | param | Collider parameters. |
Returns
| Type | Description |
|---|---|
| T | The new collider shape. |
Type Parameters
| Name | Description |
|---|---|
| T | The ColliderShape type. |
Overrides
CreateJoint<T, J>(J)
Creates a joint.
Declaration
public override T CreateJoint<T, J>(J jointDef) where T : IJoint3D where J : JointDef3D<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. |
Overrides
CreatePhysicAction<T>(params object[])
Creates a physics action instance (character, vehicle controllers, etc.)
Declaration
public override T CreatePhysicAction<T>(params object[] param) where T : IPhysicAction3D
Parameters
| Type | Name | Description |
|---|---|---|
| object[] | param | The initialization parameters. |
Returns
| Type | Description |
|---|---|
| T | The created instance. |
Type Parameters
| Name | Description |
|---|---|
| T | The type of the physics action. |
Overrides
CreatePhysicBody<T, J>(J)
Creates a StaticBody 3D.
Declaration
public override T CreatePhysicBody<T, J>(J bodyDef) where T : IPhysicBody3D where J : PhysicBodyDef3D<T>
Parameters
| Type | Name | Description |
|---|---|---|
| J | bodyDef | Body definition. |
Returns
| Type | Description |
|---|---|
| T | The static body instance. |
Type Parameters
| Name | Description |
|---|---|
| T | The physics body interface. |
| J | The body definition class. |
Overrides
DebugDraw()
Draws the debug information.
Declaration
public override void DebugDraw()
Overrides
Destroy()
Destroys this object.
Declaration
public override void Destroy()
Overrides
Dispose()
Dispose the bullet world.
Declaration
public void Dispose()
Initialize()
Initialize the bullet simulation.
Declaration
protected void Initialize()
OnAttached()
Invoked when the object is attached to the system.
Declaration
protected override bool OnAttached()
Returns
| Type | Description |
|---|---|
| bool | True if everything is OK. |
Overrides
Pause()
Pause the world.
Declaration
public void Pause()
PointTest(IColliderShape3D, ref Vector3)
Tests if a point is inside a physics body.
Declaration
public override bool PointTest(IColliderShape3D shape, ref Vector3 position)
Parameters
| Type | Name | Description |
|---|---|---|
| IColliderShape3D | shape | |
| Vector3 | position | The position to test in world coordinates. |
Returns
| Type | Description |
|---|---|
| bool | True if the position is inside the body. |
Overrides
PointTest(IPhysicBody3D, ref Vector3)
Tests if a point is inside a physical body.
Declaration
public override bool PointTest(IPhysicBody3D physicBody, ref Vector3 position)
Parameters
| Type | Name | Description |
|---|---|---|
| IPhysicBody3D | physicBody | The physical body. |
| Vector3 | position | The position to test in world coordinates. |
Returns
| Type | Description |
|---|---|
| bool | Whether this position is inside this body. |
Overrides
RayCast(ref Ray, float, CollisionCategory3D)
Raycasts and stops at the first hit.
Declaration
public override HitResult3D RayCast(ref Ray ray, float rayDistance, CollisionCategory3D filterMask = CollisionCategory3D.All)
Parameters
| Type | Name | Description |
|---|---|---|
| Ray | ray | The ray. |
| float | rayDistance | The distance to test. |
| CollisionCategory3D | filterMask | The collision category that the ray should hit. |
Returns
| Type | Description |
|---|---|
| HitResult3D | The closest hit result. |
Overrides
RayCast(ref RayStep, CollisionCategory3D)
Performs a raycast and stops at the first hit.
Declaration
public override HitResult3D RayCast(ref RayStep rayStep, CollisionCategory3D filterMask = CollisionCategory3D.All)
Parameters
| Type | Name | Description |
|---|---|---|
| RayStep | rayStep | The ray step. |
| CollisionCategory3D | filterMask | The collision category used to filter hits. |
Returns
| Type | Description |
|---|---|
| HitResult3D | The closest hit result. |
Overrides
RayCast(ref Vector3, ref Vector3, CollisionCategory3D)
Casts a ray and stops at the first hit.
Declaration
public override HitResult3D RayCast(ref Vector3 from, ref Vector3 to, CollisionCategory3D filterMask = CollisionCategory3D.All)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector3 | from | The starting ray position. |
| Vector3 | to | The ray's endpoint. |
| CollisionCategory3D | filterMask | The collision category to be used for the raycast. |
Returns
| Type | Description |
|---|---|
| HitResult3D | The result of the closest hit. |
Overrides
RayCastAll(ref Ray, float, ICollection<HitResult3D>, CollisionCategory3D)
Raycasts and gets all the hits.
Declaration
public override void RayCastAll(ref Ray ray, float rayDistance, ICollection<HitResult3D> resultsOutput, CollisionCategory3D filterMask = CollisionCategory3D.All)
Parameters
| Type | Name | Description |
|---|---|---|
| Ray | ray | The ray. |
| float | rayDistance | The distance to test. |
| ICollection<HitResult3D> | resultsOutput | The collection where the results will be included. |
| CollisionCategory3D | filterMask | The collision category to be hit by the ray. |
Overrides
RayCastAll(ref RayStep, ICollection<HitResult3D>, CollisionCategory3D)
Raycasts and gets all the hits.
Declaration
public override void RayCastAll(ref RayStep rayStep, ICollection<HitResult3D> resultsOutput, CollisionCategory3D filterMask = CollisionCategory3D.All)
Parameters
| Type | Name | Description |
|---|---|---|
| RayStep | rayStep | The ray step. |
| ICollection<HitResult3D> | resultsOutput | The collection where the results will be included. |
| CollisionCategory3D | filterMask | The collision category to hit with the ray. |
Overrides
RayCastAll(ref Vector3, ref Vector3, ICollection<HitResult3D>, CollisionCategory3D)
Raycasts and gets all the hits.
Declaration
public override void RayCastAll(ref Vector3 from, ref Vector3 to, ICollection<HitResult3D> resultsOutput, CollisionCategory3D filterMask = CollisionCategory3D.All)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector3 | from | The starting ray position. |
| Vector3 | to | The ray endpoint. |
| ICollection<HitResult3D> | resultsOutput | The collection where the results will be stored. |
| CollisionCategory3D | filterMask | The collision category for the ray to hit. |
Overrides
RemoveJoint(IJoint3D)
Removes the joint from the physics world.
Declaration
public override void RemoveJoint(IJoint3D joint)
Parameters
| Type | Name | Description |
|---|---|---|
| IJoint3D | joint | The joint to remove. |
Overrides
RemovePhysicAction(IPhysicAction3D)
Removes the physical action.
Declaration
public override void RemovePhysicAction(IPhysicAction3D physicAction)
Parameters
| Type | Name | Description |
|---|---|---|
| IPhysicAction3D | physicAction | The physical action to remove. |
Overrides
RemovePhysicBody(IPhysicBody3D)
Removes a Rigidbody 3D from the world.
Declaration
public override void RemovePhysicBody(IPhysicBody3D body)
Parameters
| Type | Name | Description |
|---|---|---|
| IPhysicBody3D | body | The body to remove. |
Overrides
Resume()
Resume the world.
Declaration
public void Resume()
SetDebugDraw(ISimulationDebugDraw3D)
Sets the debug drawing of Simulation 2D.
Declaration
public override void SetDebugDraw(ISimulationDebugDraw3D debugDraw)
Parameters
| Type | Name | Description |
|---|---|---|
| ISimulationDebugDraw3D | debugDraw | The debug draw instance. |
Overrides
Update(TimeSpan)
Updates this manager.
Declaration
public override void Update(TimeSpan gameTime)
Parameters
| Type | Name | Description |
|---|---|---|
| TimeSpan | gameTime | The game time. |
Overrides
Events
OnPhysicStep
Event fired when the physics will take a step
Declaration
public override event EventHandler OnPhysicStep
Event Type
| Type | Description |
|---|---|
| EventHandler |