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.
Checking the stable version of the documentation...
Sprite3D
继承: SpriteBase3D < GeometryInstance3D < VisualInstance3D < Node3D < Node < Object
3D 世界中的 2D 精灵节点。
描述
在 3D 环境中显示 2D 纹理的节点。显示的纹理可以是来自较大图集纹理的区域,也可以是来自精灵表动画的帧。另见 SpriteBase3D,定义有公告板模式等属性。
属性
|
||
|
||
|
||
|
||
|
||
|
信号
frame_changed() 🔗
当 frame 更改时发出。
texture_changed() 🔗
当 texture 更改时发出。
属性说明
当前显示的精灵表中的帧。hframes 和 vframes 必须大于 1。hframes 或 vframes 发生变化时会自动调整该属性,让它在视觉上保持指向同一帧(同一行、同一列)。 如果无法保持,则会重置为 0
。
Vector2i frame_coords = Vector2i(0, 0)
🔗
显示的帧在精灵表中的坐标。这是 frame 属性的别名。vframes 或 hframes 必须大于 1。
精灵表中的列数。该属性发生变化时会对 frame 进行调整,在视觉上维持相同的帧(同一行、同一列)。如果无法维持,则会将 frame 重置为 0
。
如果为 true
,则该精灵会使用 region_rect,只显示纹理中的指定部分。
Rect2 region_rect = Rect2(0, 0, 0, 0)
🔗
要显示的图集纹理区域。region_enabled 必须是 true
。
要绘制的 Texture2D 对象。如果使用 GeometryInstance3D.material_override,则这个属性会被覆盖。仍会使用尺寸信息。
精灵表中的行数。该属性发生变化时会对 frame 进行调整,在视觉上维持相同的帧(同一行、同一列)。如果无法维持,则会将 frame 重置为 0
。