空间¶
继承人: ARVRAnchor , ARVRController , ARVROrigin , AudioStreamPlayer3D , BoneAttachment , Camera , CollisionObject , CollisionPolygon , CollisionShape , GridMap , Joint , Listener , Navigation , NavigationMeshInstance , Path , PathFollow , Position3D , ProximityGroup , RayCast , RemoteTransform , Skeleton , SpringArm , VehicleWheel , VisibilityNotifier , VisualInstance
类别: 核心
简要说明¶
最基本的3D游戏对象,所有3D相关节点的父级。
属性¶
矢量3(0,0,0) |
||
矢量3(1,1,1) |
||
转换(1,0,0,0,1,0,0,0,1,0,0,0) |
||
矢量3(0,0,0) |
||
真 |
方法¶
无效 |
|
get_parent_spatial ( ) const |
|
get_world ( ) const |
|
无效 |
global_rotate ( Vector3 axis, float angle ) |
无效 |
global_scale ( Vector3 scale ) |
无效 |
global_translate ( Vector3 offset ) |
无效 |
hide ( ) |
is_local_transform_notification_enabled ( ) const |
|
is_scale_disabled ( ) const |
|
is_set_as_toplevel ( ) const |
|
is_transform_notification_enabled ( ) const |
|
is_visible_in_tree ( ) const |
|
无效 |
|
无效 |
look_at_from_position ( Vector3 position, Vector3 target, Vector3 up ) |
无效 |
orthonormalize ( ) |
无效 |
|
无效 |
rotate_object_local ( Vector3 axis, float angle ) |
无效 |
|
无效 |
|
无效 |
|
无效 |
scale_object_local ( Vector3 scale ) |
无效 |
set_as_toplevel ( bool enable ) |
无效 |
set_disable_scale ( bool disable ) |
无效 |
set_identity ( ) |
无效 |
set_ignore_transform_notification ( bool enabled ) |
无效 |
set_notify_local_transform ( bool enable ) |
无效 |
set_notify_transform ( bool enable ) |
无效 |
show ( ) |
无效 |
|
无效 |
translate_object_local ( Vector3 offset ) |
无效 |
update_gizmo ( ) |
常量¶
NOTIFICATION_TRANSFORM_CHANGED = 2000 ---当全局转换更改时,空间节点会收到此通知。这意味着当前节点或父节点更改了其转换。
为了 NOTIFICATION_TRANSFORM_CHANGED 要工作,用户首先需要请求它, set_notify_transform .
描述¶
最基本的3D游戏对象,带有3D Transform 和可见性设置。所有其他三维游戏对象都从空间继承。使用 Spatial
作为在三维项目中移动、缩放、旋转和显示/隐藏子节点的父节点。
仿射操作(旋转、缩放、平移)发生在父级的本地坐标系中,除非 Spatial
对象设置为顶级。这个坐标系中的仿射操作对应于 Spatial
的转换。下面的“局部”一词指的是这个坐标系。连接到的坐标系 Spatial
对象本身被称为对象局部坐标系。
属性描述¶
SpatialGizmo gizmo
设定器 |
设置小控件(值) |
吸气剂 |
获取_Gizmo() |
这个 SpatialGizmo 对于此节点。例如用于 EditorSpatialGizmo 作为编辑器中的自定义可视化和编辑手柄。
Transform global_transform
设定器 |
设置全局转换(值) |
吸气剂 |
获取全局转换() |
世界空间(全球) Transform 此节点的。
Vector3 rotation
设定器 |
设置旋转(值) |
吸气剂 |
获取旋转() |
以弧度表示的局部转换的旋转部分,以y x z-euler角度格式(x角度、y角度、z角度)指定。
注: 在数学意义上,旋转是矩阵而不是向量。三个欧拉角是旋转矩阵欧拉角参数化的三个独立参数,存储在 Vector3 数据结构不是因为旋转是向量,而是因为 Vector3 作为一种方便的数据结构来存储3个浮点数。因此,在旋转“向量”上应用仿射运算是没有意义的。
Vector3 rotation_degrees
违约 |
矢量3(0,0,0) |
设定器 |
设置旋转度(值) |
吸气剂 |
得到旋转度 |
以度数表示的局部转换的旋转部分,以y x z-euler角度格式(x角度、y角度、z角度)指定。
Vector3 scale
违约 |
矢量3(1,1,1) |
设定器 |
设置刻度(值) |
吸气剂 |
获取_scale() |
扩展局部转换的一部分。
Transform transform
违约 |
转换(1,0,0,0,1,0,0,0,1,0,0,0) |
设定器 |
设置转换(值) |
吸气剂 |
获取转换() |
局部空间 Transform 关于父节点。
Vector3 translation
违约 |
矢量3(0,0,0) |
设定器 |
设置翻译(值) |
吸气剂 |
获取翻译() |
此节点的本地翻译。
bool visible
违约 |
真 |
设定器 |
设置可见(值) |
吸气剂 |
是否可见() |
如果 true
,将绘制此节点。
方法说明¶
void force_update_transform ( )
Spatial get_parent_spatial ( ) const
返回父级 Spatial
或空的 Object 如果不存在父级或父级不是类型 Spatial
.
World get_world ( ) const
返回当前 World 资源此 Spatial
节点已注册到。
围绕轴旋转全局(世界)转换,单位 Vector3 ,以弧度表示的指定角度。旋转轴在全局坐标系中。
void global_scale ( Vector3 scale )
void global_translate ( Vector3 offset )
推动全球(世界)转型 Vector3 抵消。偏移量在全局坐标系中。
void hide ( )
禁用此节点的呈现。变化 visible 到 false
.
bool is_local_transform_notification_enabled ( ) const
返回节点是否通知其本地转换更改。 Spatial
默认情况下不会传播此信息。
bool is_scale_disabled ( ) const
bool is_set_as_toplevel ( ) const
返回此节点是否设置为顶级,即是否忽略其父节点转换。
bool is_transform_notification_enabled ( ) const
返回节点是否通知其全局和本地转换更改。 Spatial
默认情况下不会传播此信息。
bool is_visible_in_tree ( ) const
返回节点是否可见,同时考虑到其父节点的可见性。
Rotates itself so that the local -Z axis points towards the target
position.
转换将首先围绕给定的 up
矢量,然后通过围绕垂直于两个 target
和 up
向量。
行动发生在全球空间。
将节点移动到指定的 position
,然后自转以指向 target
按照 look_at . 行动发生在全球空间。
void orthonormalize ( )
重置此节点的转换(如比例、倾斜和锥形),通过在此节点上执行gram-schmidt正交化来保留其旋转和平移 Transform .
绕轴旋转局部变换,单位 Vector3 ,以弧度表示的指定角度。
绕轴旋转局部变换,单位 Vector3 ,以弧度表示的指定角度。旋转轴在对象局部坐标系中。
void rotate_x ( float angle )
围绕X轴旋转以弧度表示的局部变换。
void rotate_y ( float angle )
围绕Y轴以弧度角度旋转局部变换。
void rotate_z ( float angle )
围绕Z轴旋转以弧度表示的局部变换。
void scale_object_local ( Vector3 scale )
在对象局部坐标系中,通过给定的三维比例因子来缩放局部变换。
void set_as_toplevel ( bool enable )
使节点忽略其父转换。节点转换只存在于全局空间中。
void set_disable_scale ( bool disable )
void set_identity ( )
重置此节点的所有转换(设置其 Transform 到单位矩阵)。
void set_ignore_transform_notification ( bool enabled )
设置节点是否忽略其转换(全局或本地)已更改的通知。
void set_notify_local_transform ( bool enable )
设置节点是否通知其本地转换更改。 Spatial
默认情况下不会传播此信息。
void set_notify_transform ( bool enable )
设置节点是否通知其全局和本地转换更改。 Spatial
默认情况下不会传播此信息。
void show ( )
启用此节点的呈现。变化 visible 到 true
.
转换 local_point
从这个节点的本地空间到世界空间。
转换 global_point
从世界空间到这个节点的本地空间。
void translate ( Vector3 offset )
通过给定的偏移量更改节点的位置 Vector3 .
注意翻译 offset
受节点比例的影响,因此如果按例如 (10, 1, 1)
,偏移量为 (2, 0, 0)
会增加20个 (2 * 10
)到X坐标。
void translate_object_local ( Vector3 offset )
void update_gizmo ( )
更新 SpatialGizmo 此节点的。