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...
GLTFPhysicsBody
继承: Resource < RefCounted < Object
代表 glTF 物理体。
描述
代表物理体作为 OMI_physics_body
glTF 数据和 Godot 节点之间的中介,并且它的抽象方式允许在未来添加对不同 glTF 物理扩展的支持。
教程
属性
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
方法
from_dictionary(dictionary: Dictionary) static |
|
from_node(body_node: CollisionObject3D) static |
|
to_dictionary() const |
|
to_node() const |
属性说明
Vector3 angular_velocity = Vector3(0, 0, 0)
🔗
该物理体的角速度,单位为弧度每秒。仅在物体类型为“rigid”或“vehicle”时使用。
该物体的类型。导入时,控制 Godot 应该生成哪种类型的 CollisionObject3D 节点。有效值有 “static”、“animatable”、“character”、“rigid”、“vehicle”、“trigger”。导出时,这将被压缩为 “static”、“kinematic” 或 “dynamic” 运动类型之一,或为 “trigger” 属性。
Vector3 center_of_mass = Vector3(0, 0, 0)
🔗
该物体的质心,单位为米。使用相对于物体的局部空间。质心默认为物体的原点。
Vector3 inertia_diagonal = Vector3(0, 0, 0)
🔗
物理体的惯性强度,单位为千克平方米(kg⋅m²)。这表示绕主轴的惯性,而该轴为惯性张量矩阵的对角线。仅在物体类型为 “rigid” 或 “vehicle” 时使用。
当转换为 Godot RigidBody3D 节点时,如果该值为零,则会自动计算惯性。
Quaternion inertia_orientation = Quaternion(0, 0, 0, 1)
🔗
void set_inertia_orientation(value: Quaternion)
Quaternion get_inertia_orientation()
物理体的惯性方向。这定义了惯性主轴相对于对象局部轴的旋转。仅当物体类型为“刚性”或“车辆”且 inertia_diagonal 被设置为非零值时才使用。
Basis inertia_tensor = Basis(0, 0, 0, 0, 0, 0, 0, 0, 0)
🔗
已弃用: 未来版本中可能会修改或移除该属性。
该物理体的惯性张量,单位为千克平方米(kg⋅m²)。仅在物体类型为“rigid”或“vehicle”时使用。
转换为 Godot RigidBody3D 节点时,如果该值为零,则会自动计算该惯量。
Vector3 linear_velocity = Vector3(0, 0, 0)
🔗
该物理体的线速度,单位为米每秒。仅在物体类型为“rigid”或“vehicle”时使用。
该物理体的质量,单位为千克。仅在物体类型为“rigid”或“vehicle”时使用。
方法说明
GLTFPhysicsBody from_dictionary(dictionary: Dictionary) static 🔗
通过解析 OMI_physics_body
glTF 扩展格式中给定的 Dictionary,创建新的 GLTFPhysicsBody 实例。
GLTFPhysicsBody from_node(body_node: CollisionObject3D) static 🔗
从给定的 Godot CollisionObject3D 节点新建 GLTFPhysicsBody 实例。
Dictionary to_dictionary() const 🔗
将这个 GLTFPhysicsBody 实例序列化到 Dictionary 中。使用的是 OMI_physics_body
glTF 扩展所需要的格式。
CollisionObject3D to_node() const 🔗
将这个 GLTFPhysicsBody 实例转换为 Godot CollisionObject3D 节点。