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 you want to apply the 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 physics simulation. Default value of 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 every step.
Declaration
public override int MaxSubSteps { get; set; }
Property Value
Type | Description |
---|---|
int |
Overrides
PhysicWorldResolution
Gets or sets the resolution of the physic world. Changing this value does not affect the size or positions of Evergine entities. It only affects internally in the physic world.
Declaration
public override float PhysicWorldResolution { get; set; }
Property Value
Type | Description |
---|---|
float |
Overrides
Methods
AddPhysicBody(IPhysicBody3D)
Add the physic 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 perform a collision test against the specified physic 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 physic body to detect contact. |
IPhysicBody3D | physicBodyB | The second physic body to detect contact. |
IColliderShape3D | colliderShapeA | The collider on bodyA to test. |
IColliderShape3D | colliderShapeB | The collider on bodyB to test. |
ICollection<ContactPoint3D> | contactPointCollection |
Returns
Type | Description |
---|---|
int | The number of contacts detected. |
Overrides
ContactTest(IPhysicBody3D, IColliderShape3D, ICollection<ContactPoint3D>)
The contact test query perform a collision test against all overlapping objects in the physic world.
Declaration
public override int ContactTest(IPhysicBody3D physicBody, IColliderShape3D colliderShape, ICollection<ContactPoint3D> contactPointCollection)
Parameters
Type | Name | Description |
---|---|---|
IPhysicBody3D | physicBody | The physic 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)
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 from matrix. |
Matrix4x4 | to | The to matrix. |
CollisionCategory3D | filterMask | The collision category to hit the ray. |
Returns
Type | Description |
---|---|
HitResult3D | The hit result. |
Overrides
ConvexSweepTestAll(IColliderShape3D, ref Matrix4x4, ref Matrix4x4, ICollection<HitResult3D>, CollisionCategory3D)
Sweep test using a collider shape and 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 from matrix. |
Matrix4x4 | to | The to matrix. |
ICollection<HitResult3D> | resultsOutput | The collection where the contact results will be included. |
CollisionCategory3D | filterMask | The collision category to hit the ray. |
Overrides
CreateColliderShape<T>(params object[])
Instantiate 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[])
Create a physic action instance (character, vehicle controllers...)
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 physic 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 physic body interface. |
J | The body definition class. |
Overrides
DebugDraw()
Draw the debug information.
Declaration
public override void DebugDraw()
Overrides
Destroy()
Destroy 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 all is OK. |
Overrides
Pause()
Pause the world.
Declaration
public void Pause()
PointTest(IColliderShape3D, ref Vector3)
Test if a point is inside a physic 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 | If this position is inside this body. |
Overrides
PointTest(IPhysicBody3D, ref Vector3)
Test if a point is inside a physic body.
Declaration
public override bool PointTest(IPhysicBody3D physicBody, ref Vector3 position)
Parameters
Type | Name | Description |
---|---|---|
IPhysicBody3D | physicBody | The physic body. |
Vector3 | position | The position to test in world coordinates. |
Returns
Type | Description |
---|---|
bool | If this position is inside this body. |
Overrides
RayCast(ref Ray, float, CollisionCategory3D)
Raycast and stop 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 to hit the ray. |
Returns
Type | Description |
---|---|
HitResult3D | The closest hit result. |
Overrides
RayCast(ref RayStep, CollisionCategory3D)
Raycast and stop 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 to hit the ray. |
Returns
Type | Description |
---|---|
HitResult3D | The closest hit result. |
Overrides
RayCast(ref Vector3, ref Vector3, CollisionCategory3D)
Raycast and stop 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 start ray position. |
Vector3 | to | The ray ending. |
CollisionCategory3D | filterMask | The collision category to hit the ray. |
Returns
Type | Description |
---|---|
HitResult3D | The closest hit result. |
Overrides
RayCastAll(ref Ray, float, ICollection<HitResult3D>, CollisionCategory3D)
Raycast 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 hit the ray. |
Overrides
RayCastAll(ref RayStep, ICollection<HitResult3D>, CollisionCategory3D)
Raycast 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 the ray. |
Overrides
RayCastAll(ref Vector3, ref Vector3, ICollection<HitResult3D>, CollisionCategory3D)
Raycast 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 start ray position. |
Vector3 | to | The ray ending. |
ICollection<HitResult3D> | resultsOutput | The collection where the results will be included. |
CollisionCategory3D | filterMask | The collision category to hit the ray. |
Overrides
RemoveJoint(IJoint3D)
Remove the joint from the physic world.
Declaration
public override void RemoveJoint(IJoint3D joint)
Parameters
Type | Name | Description |
---|---|---|
IJoint3D | joint | The joint to remove. |
Overrides
RemovePhysicAction(IPhysicAction3D)
Remove the physic action.
Declaration
public override void RemovePhysicAction(IPhysicAction3D physicAction)
Parameters
Type | Name | Description |
---|---|---|
IPhysicAction3D | physicAction | The physic 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 draw of Simulation 2D.
Declaration
public override void SetDebugDraw(ISimulationDebugDraw3D debugDraw)
Parameters
Type | Name | Description |
---|---|---|
ISimulationDebugDraw3D | debugDraw | The debug draw instance. |
Overrides
Update(TimeSpan)
Update 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 do an step
Declaration
public override event EventHandler OnPhysicStep
Event Type
Type | Description |
---|---|
EventHandler |