Table of Contents

Class PrimitiveEntityOptions

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

The options of a primitive entity created with CreatePrimitive: its name, material, render group, position, and the kind of physics the chosen engine gives it.

public class PrimitiveEntityOptions
Inheritance
PrimitiveEntityOptions
Derived

Remarks

The physics packages derive their own options from this one, BepuPhysicsOptions and BulletPhysicsOptions, adding the engine's component and mass. A 2D shape's collider depth is on the shape, not here.

Properties

Body

The kind of physics the engine chosen by the scene setup attaches: a dynamic body by default, a static collider, a kinematic body, or none.

public BodyMode Body { get; set; }

Property Value

BodyMode

Remarks

Read only when the physics options supply no component of their own; a supplied component wins, and a supplied component with None is refused. Without a setup, or with None, nothing is attached whatever this says. The physics packages' entity extensions (AddBepuPhysics, AddBulletPhysics) read it the same way.

EntityName

Gets or sets the optional name assigned to the created entity.

public string? EntityName { get; set; }

Property Value

string

Remarks

If null, the creation helper may assign a name or leave the entity unnamed.

Material

Gets or sets the material to apply to the generated primitive model.

public Material? Material { get; set; }

Property Value

Material

Remarks

If null, the generated model uses the material behaviour defined by the creation helper or the engine.

Position

Gets or sets the initial world position applied to the entity's transform.

public Vector3? Position { get; set; }

Property Value

Vector3?

Remarks

If null, the entity keeps the default transform position, Zero.

RenderGroup

Gets or sets the render group assigned to the generated model component.

public RenderGroup RenderGroup { get; set; }

Property Value

RenderGroup

Remarks

Defaults to Group0. Render groups can be used to route entities through different rendering passes or layers.

ShareModel

Whether the entity draws the one model the game keeps for this shape and material, the one GetOrCreateModel(IGame, Primitive3D, Material?) returns, instead of a model generated for this call alone. Defaults to false. Set it for the many entities that draw the same thing: one mesh and one pair of GPU buffers between them, at the price that a change to the model shows on all of them.

public bool ShareModel { get; set; }

Property Value

bool

Methods

WithBody(BodyMode)

A copy of the options with another Body, the rest as it is, whatever the runtime type.

public PrimitiveEntityOptions WithBody(BodyMode body)

Parameters

body BodyMode

The mode of the copy.

Returns

PrimitiveEntityOptions

A shallow copy: a supplied component, where the type has one, is the same instance.

Remarks

The ground helpers use it to ask for a static collider without changing the options they were given.