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...
GLTFPhysicsShape¶
继承: Resource < RefCounted < Object
代表 GLTF 物理形状。
描述¶
代表 OMI_collider
GLTF 扩展中定义的物理形状。这个类是 GLTF 数据与 Godot 节点的中介,并且经过了抽象,支持将来加入各种 GLTF 物理扩展。
教程¶
属性¶
|
||
|
||
|
||
|
||
|
||
|
方法¶
from_dictionary ( Dictionary dictionary ) static |
|
from_node ( CollisionShape3D shape_node ) static |
|
to_dictionary ( ) const |
|
属性说明¶
float height = 2.0
形状的高度,单位为米。仅在形状类型为“capsule”或“cylinder”时使用。这个值不能为负数,并且对于“capsule”而言应当至少是半径的两倍。
ImporterMesh importer_mesh
void set_importer_mesh ( ImporterMesh value )
ImporterMesh get_importer_mesh ( )
形状的 ImporterMesh 资源。仅在形状类型为“hull”(凸包)和“trimesh”(凹三角网格)时使用。
bool is_trigger = false
如果为 true
,则表示这个形状是触发器。对于 Godot 而言,这意味着该形状应当是 Area3D 节点的子节点。
这是 to_node 方法中唯一没有用到的变量,应该单独用来确定要将生成的节点添加到哪个节点之下。
int mesh_index = -1
形状网格在 GLTF 文件中的索引。仅在形状类型为“hull”(凸包)和“trimesh”(凹三角网格)时使用。
float radius = 0.5
形状的半径,单位为米。仅在形状类型为“capsule”“cylinder”或“sphere”时使用。这个值不应为负数。
String shape_type = ""
这个形状所代表的形状类型。有效取值有“box”“capsule”“cylinder”“sphere”“hull”以及“trimesh”。
Vector3 size = Vector3(1, 1, 1)
形状的大小,单位为米。仅在碰撞体类型为“box”时使用,代表盒子的“直径”。这个值不应为负数。
方法说明¶
GLTFPhysicsShape from_dictionary ( Dictionary dictionary ) static
通过解析给定的 Dictionary 新建 GLTFPhysicsShape 实例。
GLTFPhysicsShape from_node ( CollisionShape3D shape_node ) static
根据给定的 Godot CollisionShape3D 节点新建 GLTFPhysicsShape 实例。
Dictionary to_dictionary ( ) const
将这个 GLTFPhysicsShape 实例序列化为 Dictionary。
CollisionShape3D to_node ( bool cache_shapes=false )
将这个 GLTFPhysicsShape 实例转换为 Godot CollisionShape3D 节点。