Sprite3D
2D sprite node in a 3D world.
2D sprite node in a 3D world.
A node that displays a 2D texture in a 3D environment. The texture displayed can be a region from a larger atlas texture, or a frame from a sprite sheet animation. See also SpriteBase3D where properties such as the billboard mode are defined.
Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.
Constructors1
Sprite3DConstructor
public Sprite3D();Properties7
FrameProperty
public int Frame { get; set; }Current frame to display from sprite sheet. Sprite3D.Hframes or Sprite3D.Vframes must be greater than 1. This property is automatically adjusted when Sprite3D.Hframes or Sprite3D.Vframes are changed to keep pointing to the same visual frame (same column and row). If that's impossible, this value is reset to 0.
FrameCoordsProperty
public Vector2I FrameCoords { get; set; }Coordinates of the frame to display from sprite sheet. This is as an alias for the Sprite3D.Frame property. Sprite3D.Hframes or Sprite3D.Vframes must be greater than 1.
HframesProperty
public int Hframes { get; set; }The number of columns in the sprite sheet. When this property is changed, Sprite3D.Frame is adjusted so that the same visual frame is maintained (same row and column). If that's impossible, Sprite3D.Frame is reset to 0.
RegionEnabledProperty
public bool RegionEnabled { get; set; }If true, the sprite will use Sprite3D.RegionRect and display only the specified part of its texture.
RegionRectProperty
public Rect2 RegionRect { get; set; }The region of the atlas texture to display. Sprite3D.RegionEnabled must be true.
TextureProperty
public Texture2D Texture { get; set; }Texture2D object to draw. If GeometryInstance3D.MaterialOverride is used, this will be overridden. The size information is still used.
VframesProperty
public int Vframes { get; set; }The number of rows in the sprite sheet. When this property is changed, Sprite3D.Frame is adjusted so that the same visual frame is maintained (same row and column). If that's impossible, Sprite3D.Frame is reset to 0.
Methods14
GetFrameint
public int GetFrame();intGetFrameCoordsVector2I
public Vector2I GetFrameCoords();Vector2IGetHframesint
public int GetHframes();intGetRegionRectRect2
public Rect2 GetRegionRect();Rect2GetTextureTexture2D
public Texture2D GetTexture();Texture2DGetVframesint
public int GetVframes();intIsRegionEnabledbool
public bool IsRegionEnabled();boolSetFramevoid
public void SetFrame(int frame);| Name | Type | Default |
|---|---|---|
frame | int | — |
SetFrameCoordsvoid
public void SetFrameCoords(Vector2I coords);| Name | Type | Default |
|---|---|---|
coords | Vector2I | — |
SetHframesvoid
public void SetHframes(int hframes);| Name | Type | Default |
|---|---|---|
hframes | int | — |
SetRegionEnabledvoid
public void SetRegionEnabled(bool enabled);| Name | Type | Default |
|---|---|---|
enabled | bool | — |
SetRegionRectvoid
public void SetRegionRect(Rect2 rect);| Name | Type | Default |
|---|---|---|
rect | Rect2 | — |
SetTexturevoid
public void SetTexture(Texture2D texture);| Name | Type | Default |
|---|---|---|
texture | Texture2D | — |
SetVframesvoid
public void SetVframes(int vframes);| Name | Type | Default |
|---|---|---|
vframes | int | — |
Signals and events2
FrameChangedEvent
public event Action FrameChanged;Emitted when the Sprite3D.Frame changes.
TextureChangedEvent
public event Action TextureChanged;Emitted when the Sprite3D.Texture changes.