Godot Engine 3.2 Alpha
Spatial类继承于Node类,是所有3D节点类的基类
常用属性
| 类型 | 属性名 | 说明 |
|---|---|---|
| SpatialGizmo | gizmo | Editor中的那个Gizmo,只在Editor里起作用 |
| Transform | global_transform | 世界坐标系中的变换 |
| Vector3 | rotation | 局部坐标系旋转(弧度制) |
| Vector3 | rotation_degrees | 局部坐标系旋转(角度制) |
| Vector3 | scale | 局部坐标系缩放 |
| Transform | transform | 相对于父节点的局部变换 |
| Vector3 | translation | 局部坐标,叫tansilation,其实就是position |
| bool | visible | 可见性 |
常用方法
| 类型 | 方法名 | 说明 |
|---|---|---|
| void | force_update_transform ( ) | |
| Spatial | get_parent_spatial ( ) const | |
| World | get_world ( ) const | |
| void | global_rotate ( Vector3 axis, float angle ) | |
| void | global_scale ( Vector3 scale ) | |
| void | global_translate ( Vector3 offset ) | 世界坐标系下移动,注意参数是偏移量 |
| void | hide ( ) | 隐藏,即visable = false |
| bool | is_local_transform_notification_enabled ( ) const | |
| bool | is_scale_disabled ( ) const | |
| bool | is_set_as_toplevel ( ) const | |
| bool | is_transform_notification_enabled ( ) const | |
| bool | is_visible_in_tree ( ) const | 返回可见性(绝对) |
| void | look_at ( Vector3 target, Vector3 up ) | 让自身的-Z朝向所给点 |
| void | look_at_from_position ( Vector3 position, Vector3 target, Vector3 up ) | |
| void | orthonormalize ( ) | |
| void | rotate ( Vector3 axis, float angle ) | |
| void | rotate_object_local ( Vector3 axis, float angle ) | |
| void | rotate_x ( float angle ) | 想单独在某个轴向旋转很方便 |
| void | rotate_y ( float angle ) | 想单独在某个轴向旋转很方便 |
| void | rotate_z ( float angle ) | 想单独在某个轴向旋转很方便 |
| void | scale_object_local ( Vector3 scale ) | |
| void | set_as_toplevel ( bool enable ) | |
| void | set_disable_scale ( bool disable ) | |
| void | set_identity ( ) | 重置所有变换 |
| void | set_ignore_transform_notification ( bool enabled ) | |
| void | set_notify_local_transform ( bool enable ) | |
| void | set_notify_transform ( bool enable ) | |
| void | show ( ) | 显示,即visable = true |
| Vector3 | to_global ( Vector3 local_point ) const | 工具方法,用于局部坐标和世界坐标换算 |
| Vector3 | to_local ( Vector3 global_point ) const | 工具方法,用于局部坐标和世界坐标换算 |
| void | translate ( Vector3 offset ) | 移动,注意参数是偏移量,并且移动结果受缩放值影响 |
| void | translate_object_local ( Vector3 offset ) | |
| void | update_gizmo ( ) |
