Search Results for

    Show / Hide Table of Contents

    Class BulletPhysicManager3D

    The Simulation3D class manages all 3D physics entities.

    Inheritance
    object
    IdentifiableObject
    DependencyObject
    AttachableObject
    SceneManager
    UpdatableSceneManager
    PhysicManager3D
    BulletPhysicManager3D
    Implements
    IDependencyObject
    Inherited Members
    PhysicManager3D.RenderManager
    PhysicManager3D.PhysicComponentList
    PhysicManager3D.PerformPhysicSteps
    PhysicManager3D.OnLoaded()
    PhysicManager3D.OnDetach()
    PhysicManager3D.ContactTest(IPhysicBody3D, ICollection<ContactPoint3D>)
    PhysicManager3D.ContactPairTest(IPhysicBody3D, IPhysicBody3D, ICollection<ContactPoint3D>)
    PhysicManager3D.AddPhysicComponent(Behavior)
    PhysicManager3D.RemovePhysicComponent(Behavior)
    PhysicManager3D.OnCameraRender(object, DrawContext)
    SceneManager.Managers
    SceneManager.Scene
    SceneManager.OnActivated()
    SceneManager.Start()
    SceneManager.OnDeactivated()
    SceneManager.OnDestroy()
    AttachableObject.AttachableStateChanged
    AttachableObject.IsEnabled
    AttachableObject.State
    AttachableObject.IsLoaded
    AttachableObject.IsAttached
    AttachableObject.IsActivated
    AttachableObject.IsStarted
    AttachableObject.IsDestroyed
    AttachableObject.ShouldBeActivated
    AttachableObject.DependencyBroken()
    DependencyObject.Dependencies
    DependencyObject.OnDependencyRemoved
    IdentifiableObject.Id
    IdentifiableObject.IdHasChanged(Guid)
    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
    PhysicManager3D.ApplySpeculativeContactRestitution

    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
    PhysicManager3D.DrawFlags

    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
    PhysicManager3D.FixedTimeStep

    Gravity

    Gets or sets the global gravity vector.

    Declaration
    public override Vector3 Gravity { get; set; }
    Property Value
    Type Description
    Vector3
    Overrides
    PhysicManager3D.Gravity

    InternalWorld

    Gets the internal native world instance.

    Declaration
    public override object InternalWorld { get; }
    Property Value
    Type Description
    object
    Overrides
    PhysicManager3D.InternalWorld

    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
    PhysicManager3D.MaxSubSteps

    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. By default, the resolution of the world is 1. This means that 1 unit in Evergine is equal to 1 unit in the physics world. Changing it to 10 indicates that 1 unit in Evergine is equivalent to 10 units in the physics world. We recommend increasing this value up to 10 if your physics bodies usually have sizes of centimeters.

    Declaration
    public override float PhysicWorldResolution { get; set; }
    Property Value
    Type Description
    float
    Overrides
    PhysicManager3D.PhysicWorldResolution

    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
    PhysicManager3D.AddPhysicBody(IPhysicBody3D)

    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
    PhysicManager3D.ContactPairTest(IPhysicBody3D, IPhysicBody3D, IColliderShape3D, IColliderShape3D, ICollection<ContactPoint3D>)

    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
    PhysicManager3D.ContactTest(IPhysicBody3D, IColliderShape3D, ICollection<ContactPoint3D>)
    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
    PhysicManager3D.ConvexSweepTest(IColliderShape3D, ref Matrix4x4, ref Matrix4x4, CollisionCategory3D)

    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
    PhysicManager3D.ConvexSweepTestAll(IColliderShape3D, ref Matrix4x4, ref Matrix4x4, ICollection<HitResult3D>, CollisionCategory3D)

    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
    PhysicManager3D.CreateColliderShape<T>(params object[])

    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
    Evergine.Framework.Managers.PhysicManager3D.CreateJoint<T, J>(J)

    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
    PhysicManager3D.CreatePhysicAction<T>(params object[])

    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
    Evergine.Framework.Managers.PhysicManager3D.CreatePhysicBody<T, J>(J)

    DebugDraw()

    Draws the debug information.

    Declaration
    public override void DebugDraw()
    Overrides
    PhysicManager3D.DebugDraw()

    Destroy()

    Destroys this object.

    Declaration
    public override void Destroy()
    Overrides
    AttachableObject.Destroy()

    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
    PhysicManager3D.OnAttached()

    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
    PhysicManager3D.PointTest(IColliderShape3D, ref Vector3)

    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
    PhysicManager3D.PointTest(IPhysicBody3D, ref Vector3)

    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
    PhysicManager3D.RayCast(ref Ray, float, CollisionCategory3D)

    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
    PhysicManager3D.RayCast(ref RayStep, CollisionCategory3D)

    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
    PhysicManager3D.RayCast(ref Vector3, ref Vector3, CollisionCategory3D)

    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
    PhysicManager3D.RayCastAll(ref Ray, float, ICollection<HitResult3D>, CollisionCategory3D)

    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
    PhysicManager3D.RayCastAll(ref RayStep, ICollection<HitResult3D>, CollisionCategory3D)

    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
    PhysicManager3D.RayCastAll(ref Vector3, ref Vector3, ICollection<HitResult3D>, CollisionCategory3D)

    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
    PhysicManager3D.RemoveJoint(IJoint3D)

    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
    PhysicManager3D.RemovePhysicAction(IPhysicAction3D)

    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
    PhysicManager3D.RemovePhysicBody(IPhysicBody3D)

    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
    PhysicManager3D.SetDebugDraw(ISimulationDebugDraw3D)

    Update(TimeSpan)

    Updates this manager.

    Declaration
    public override void Update(TimeSpan gameTime)
    Parameters
    Type Name Description
    TimeSpan gameTime

    The game time.

    Overrides
    UpdatableSceneManager.Update(TimeSpan)

    Events

    OnPhysicStep

    Event fired when the physics will take a step

    Declaration
    public override event EventHandler OnPhysicStep
    Event Type
    Type Description
    EventHandler
    Overrides
    PhysicManager3D.OnPhysicStep

    Implements

    IDependencyObject

    Extension Methods

    ReflectionHelper.GetMemberAssembly(object)
    ReflectionHelper.GetTypeName(object)
    In this article
    Back to top
    Generated by DocFX