Table of Contents

Class TranslationGizmo

Namespace
Stride.CommunityToolkit.Rendering.Gizmos
Assembly
Stride.CommunityToolkit.dll

Represents a visual translation gizmo used for moving objects in a 3D scene.

public class TranslationGizmo : AxialGizmoBase
Inheritance
TranslationGizmo
Inherited Members

Remarks

This class creates a visual aid for object manipulation, consisting of axis arrows and planes, which can be used to indicate or manipulate movement along specific axes or planes. It is designed as an extension and can be added to any entity in a scene for visual feedback.

Constructors

TranslationGizmo(GraphicsDevice)

Initializes a new instance of the TranslationGizmo class with the specified graphics device.

public TranslationGizmo(GraphicsDevice graphicsDevice)

Parameters

graphicsDevice GraphicsDevice

The graphics device used to render the gizmo.

TranslationGizmo(GraphicsDevice, Color?, Color?, Color?)

Initializes a new instance of the TranslationGizmo class with the specified graphics device and optional colors for each axis.

public TranslationGizmo(GraphicsDevice graphicsDevice, Color? xColor = null, Color? yColor = null, Color? zColor = null)

Parameters

graphicsDevice GraphicsDevice

The graphics device used to render the gizmo.

xColor Color?

Optional color for the X-axis.

yColor Color?

Optional color for the Y-axis.

zColor Color?

Optional color for the Z-axis.

Methods

Create(Entity, bool, bool)

Creates the translation gizmo entities and adds them to the specified parent entity.

public void Create(Entity entity, bool showAxisName = false, bool rotateAxisNames = true)

Parameters

entity Entity

The entity to which the gizmo will be added.

showAxisName bool

Determines whether the axis names should be displayed.

rotateAxisNames bool

Determines whether the axis names should be rotated to match the axes' orientation.

Create(Scene)

Creates and returns a new translation gizmo entity, adding it to the specified scene.

public Entity Create(Scene scene)

Parameters

scene Scene

The scene to which the gizmo will be added.

Returns

Entity

The created translation gizmo entity.

CreateUniformColorMaterial(Color)

Creates a uniform color material for the gizmo.

protected Material CreateUniformColorMaterial(Color color)

Parameters

color Color

The color of the material.

Returns

Material

The created material.

GetAxisDefaultMaterial(int)

Retrieves the default material for the specified axis.

protected Material? GetAxisDefaultMaterial(int axisIndex)

Parameters

axisIndex int

The index of the axis (0 for X, 1 for Y, 2 for Z).

Returns

Material

The material for the specified axis.