Table of Contents

Class GroundExtensions

Namespace
Stride.CommunityToolkit.Engine
Assembly
Stride.CommunityToolkit.dll

Extension methods on Game that add a ground to the root scene, with a static collider from the physics engine the scene setup chose.

public static class GroundExtensions
Inheritance
GroundExtensions

Methods

Add2DGround(IGame, Vector2?, Primitive2DEntityOptions?)

Adds a 2D ground to the root scene: a flat box of the given width (X) and height (Y) in the XY plane, at Default2DGroundPosition, with a static collider from the physics engine the scene setup chose.

public static Entity Add2DGround(this IGame game, Vector2? size = null, Primitive2DEntityOptions? options = null)

Parameters

game IGame

The game whose root scene gets the ground.

size Vector2?

The width and height of the ground. Defaults to Default2DGroundSize; its depth along Z is always that default's.

options Primitive2DEntityOptions

The entity options. EntityName defaults to DefaultGroundName, Position to Default2DGroundPosition, the material to a flat grey; Depth is the collider's thickness. A physics package's options (Bepu2DPhysicsOptions) are read back by that package.

Returns

Entity

The ground entity, already in the root scene.

Add3DGround(IGame, Vector2?, Primitive3DEntityOptions?)

Adds a ground to the root scene: a plane of the given width (X) and length (Z), with a static collider from the physics engine the scene setup chose.

public static Entity Add3DGround(this IGame game, Vector2? size = null, Primitive3DEntityOptions? options = null)

Parameters

game IGame

The game whose root scene gets the ground.

size Vector2?

The width and length of the plane. Defaults to Default3DGroundSize.

options Primitive3DEntityOptions

The entity options. EntityName defaults to DefaultGroundName, Material to a dark grey; IncludePhysics off leaves the collider out. A physics package's options (Bepu3DPhysicsOptions) are read back by that package.

Returns

Entity

The ground entity, already in the root scene.

Remarks

Without a physics engine in the setup, or in a Game Studio project, the ground is the plane alone.