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 扩展中定义的物理体。这个类是 GLTF 数据与 Godot 节点的中介,并且经过了抽象,支持将来加入各种 GLTF 物理扩展。
教程¶
属性¶
|
||
|
||
|
||
|
||
|
||
|
方法¶
from_dictionary ( Dictionary dictionary ) static |
|
from_node ( CollisionObject3D body_node ) static |
|
to_dictionary ( ) const |
|
to_node ( ) const |
属性说明¶
Vector3 angular_velocity = Vector3(0, 0, 0)
该物理体的角速度,单位为弧度每秒。仅在物体类型为“rigid”或“vehicle”时使用。
String body_type = "static"
该物体的类型。导入时,控制 Godot 应该生成何种类型的 CollisionObject3D 节点。有效值有“static”“kinematic”“character”“rigid”“vehicle”“trigger”。
Vector3 center_of_mass = Vector3(0, 0, 0)
该物体的质心,单位为米。使用相对于物体的局部空间。质心默认为物体的原点。
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”时使用。
float mass = 1.0
该物理体的质量,单位为千克。仅在物体类型为“rigid”或“vehicle”时使用。
方法说明¶
GLTFPhysicsBody from_dictionary ( Dictionary dictionary ) static
通过解析给定的 Dictionary 新建 GLTFPhysicsBody 实例。
GLTFPhysicsBody from_node ( CollisionObject3D body_node ) static
从给定的 Godot CollisionObject3D 节点新建 GLTFPhysicsBody 实例。
Dictionary to_dictionary ( ) const
将这个 GLTFPhysicsBody 实例序列化为 Dictionary。
CollisionObject3D to_node ( ) const
将这个 GLTFPhysicsBody 实例转换为 Godot CollisionObject3D 节点。