Table of Contents

Give me a cube

This example demonstrates the essential steps to create a 3D cube in Stride. Just like the previous example, the cube entity comes automatically equipped with a rigid body and a collider, thanks to the CreatePrimitive() method.

The cube is positioned at (1f, 0.5f, 3f) in the 3D world space. This example is perfect for those who are new to 3D game development with Stride.

Stride UI Example

View on GitHub.

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

using var game = new Game();

game.Run(start: Start);

void Start(Scene rootScene)

    var entity = game.Create3DPrimitive(PrimitiveModelType.Cube);

    entity.Transform.Position = new Vector3(1f, 0.5f, 3f);

    entity.Scene = rootScene;