Table of Contents

Basic2D Scene (Capsule)

Create a minimal 2D scene using toolkit helpers and place a single capsule primitive with a flat material. Demonstrates primitive creation, basic positioning, and attaching the entity to the scene.

The Program.cs file shows how to:

  • Creating a 2D primitive with Create2DPrimitive
  • Applying a flat material with CreateFlatMaterial
  • Setting an entity position through primitive options
  • Adding entities to a Scene (rootScene)
  • Using helpers: SetupBase2DScene

Basic2D Scene (Capsule)

View on GitHub.

using Stride.CommunityToolkit.Bepu;
using Stride.CommunityToolkit.Engine;
using Stride.CommunityToolkit.Rendering.ProceduralModels;
using Stride.Core.Mathematics;
using Stride.Engine;

using var game = new Game();

game.Run(start: Start);

void Start(Scene rootScene)
{
    game.SetupBase2DScene();

    var entity = game.Create2DPrimitive(Primitive2DModelType.Capsule, new()
    {
        Material = game.CreateFlatMaterial(Color.White)
    });
    entity.Transform.Position = new Vector3(0, 8, 0);
    entity.Scene = rootScene;
}