Class TranslationGizmo
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
graphicsDeviceGraphicsDeviceThe 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
graphicsDeviceGraphicsDeviceThe graphics device used to render the gizmo.
xColorColor?Optional color for the X-axis.
yColorColor?Optional color for the Y-axis.
zColorColor?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
entityEntityThe entity to which the gizmo will be added.
showAxisNameboolDetermines whether the axis names should be displayed.
rotateAxisNamesboolDetermines 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
sceneSceneThe 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
colorColorThe 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
axisIndexintThe index of the axis (0 for X, 1 for Y, 2 for Z).
Returns
- Material
The material for the specified axis.