Class GameExtensions
Extension methods on Game for a scene with Bullet physics. The scene itself is set up through
UseBullet<T>(T) on a SceneSetup; the core's CreatePrimitive,
Add3DGround and Add2DGround then attach Bullet bodies and colliders. What is here exists only in Bullet.
public static class GameExtensions
- Inheritance
-
GameExtensions
Methods
AddInfinite3DGround(IGame, Vector2?, Bullet3DPhysicsOptions?)
Adds an infinite ground to the root scene: a visible plane of the given size with Bullet's infinite static plane as its collider, so nothing can fall off the edge.
public static Entity AddInfinite3DGround(this IGame game, Vector2? size = null, Bullet3DPhysicsOptions? options = null)
Parameters
gameIGameThe game whose root scene gets the ground.
sizeVector2?The width (X) and length (Z) of the visible plane. Defaults to Default3DGroundSize; the collider is infinite either way.
optionsBullet3DPhysicsOptionsOptional physics options. If
null, defaults will be used.
Returns
- Entity
The ground entity, already in the root scene.
Remarks
The ground gets a StaticColliderComponent unless options sets PhysicsComponent. If EntityName is not provided, DefaultGroundName is used.
The physics is attached here whatever the scene setup chose, since the plane collider is Bullet's own.
ShowColliders(IGame)
Enables the visualization of collider shapes in the game scene for debugging physics-related issues.
public static IGame ShowColliders(this IGame game)
Parameters
gameIGameThe current game instance.
Returns
- IGame
The game, so a chain of setup calls continues.
Remarks
This method activates the rendering of collider shapes within the physics simulation, helping to visually inspect and debug the positioning and behavior of colliders at runtime.