Attention: Here be dragons

This is the latest (unstable) version of this documentation, which may document features not available in or compatible with released stable versions of Godot.

Sprite3D

繼承: SpriteBase3D < GeometryInstance3D < VisualInstance3D < Node3D < Node < Object

3D 世界中的 2D 精靈節點。

說明

在 3D 環境中顯示 2D 紋理的節點。顯示的紋理可以是來自較大合集紋理的區域,也可以是來自精靈表動畫的影格。另見 SpriteBase3D,定義有公告板模式等屬性。

屬性

int

frame

0

Vector2i

frame_coords

Vector2i(0, 0)

int

hframes

1

bool

region_enabled

false

Rect2

region_rect

Rect2(0, 0, 0, 0)

Texture2D

texture

int

vframes

1


訊號

frame_changed() 🔗

frame 更改時發出。


texture_changed() 🔗

texture 更改時發出。


屬性說明

int frame = 0 🔗

  • void set_frame(value: int)

  • int get_frame()

Current frame to display from sprite sheet. hframes or vframes must be greater than 1. This property is automatically adjusted when hframes or 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.


Vector2i frame_coords = Vector2i(0, 0) 🔗

顯示的影格在精靈表中的座標。這是 frame 屬性的別名。vframeshframes 必須大於 1。


int hframes = 1 🔗

  • void set_hframes(value: int)

  • int get_hframes()

The number of columns in the sprite sheet. When this property is changed, frame is adjusted so that the same visual frame is maintained (same row and column). If that's impossible, frame is reset to 0.


bool region_enabled = false 🔗

  • void set_region_enabled(value: bool)

  • bool is_region_enabled()

如果為 true,則該精靈會使用 region_rect,只顯示紋理中的指定部分。


Rect2 region_rect = Rect2(0, 0, 0, 0) 🔗

  • void set_region_rect(value: Rect2)

  • Rect2 get_region_rect()

要顯示的合集紋理區域。region_enabled 必須是 true


Texture2D texture 🔗

要繪製的 Texture2D 對象。如果使用 GeometryInstance3D.material_override,則這個屬性會被覆蓋。仍會使用尺寸資訊。


int vframes = 1 🔗

  • void set_vframes(value: int)

  • int get_vframes()

The number of rows in the sprite sheet. When this property is changed, frame is adjusted so that the same visual frame is maintained (same row and column). If that's impossible, frame is reset to 0.