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