GLTFPhysicsBody

继承: Resource < RefCounted < Object

Represents a glTF physics body.

描述

Represents a physics body as an intermediary between the OMI_physics_body glTF data and Godot's nodes, and it's abstracted in a way that allows adding support for different glTF physics extensions in the future.

属性

方法


属性说明

Vector3 angular_velocity = Vector3(0, 0, 0)

  • void set_angular_velocity ( value: Vector3 )
  • Vector3 get_angular_velocity ( )

The angular velocity of the physics body, in radians per second. This is only used when the body type is "rigid" or "vehicle".


String body_type = "rigid"

  • void set_body_type ( value: String )
  • String get_body_type ( )

The type of the body. When importing, this controls what type of CollisionObject3D node Godot should generate. Valid values are "static", "animatable", "character", "rigid", "vehicle", and "trigger". When exporting, this will be squashed down to one of "static", "kinematic", or "dynamic" motion types, or the "trigger" property.


Vector3 center_of_mass = Vector3(0, 0, 0)

  • void set_center_of_mass ( value: Vector3 )
  • Vector3 get_center_of_mass ( )

The center of mass of the body, in meters. This is in local space relative to the body. By default, the center of the mass is the body's origin.


Vector3 inertia_diagonal = Vector3(0, 0, 0)

  • void set_inertia_diagonal ( value: Vector3 )
  • Vector3 get_inertia_diagonal ( )

The inertia strength of the physics body, in kilogram meter squared (kg⋅m²). This represents the inertia around the principle axes, the diagonal of the inertia tensor matrix. This is only used when the body type is "rigid" or "vehicle".

When converted to a Godot RigidBody3D node, if this value is zero, then the inertia will be calculated automatically.


Quaternion inertia_orientation = Quaternion(0, 0, 0, 1)

The inertia orientation of the physics body. This defines the rotation of the inertia's principle axes relative to the object's local axes. This is only used when the body type is "rigid" or "vehicle" and inertia_diagonal is set to a non-zero value.


Basis inertia_tensor = Basis(0, 0, 0, 0, 0, 0, 0, 0, 0)

  • void set_inertia_tensor ( value: Basis )
  • Basis get_inertia_tensor ( )

已弃用: 未来版本中可能会修改或移除该属性。

The inertia tensor of the physics body, in kilogram meter squared (kg⋅m²). This is only used when the body type is "rigid" or "vehicle".

When converted to a Godot RigidBody3D node, if this value is zero, then the inertia will be calculated automatically.


Vector3 linear_velocity = Vector3(0, 0, 0)

  • void set_linear_velocity ( value: Vector3 )
  • Vector3 get_linear_velocity ( )

The linear velocity of the physics body, in meters per second. This is only used when the body type is "rigid" or "vehicle".


float mass = 1.0

  • void set_mass ( value: float )
  • float get_mass ( )

The mass of the physics body, in kilograms. This is only used when the body type is "rigid" or "vehicle".


方法说明

GLTFPhysicsBody from_dictionary ( dictionary: Dictionary ) static1

Creates a new GLTFPhysicsBody instance by parsing the given Dictionary in the OMI_physics_body glTF extension format.


GLTFPhysicsBody from_node ( body_node: CollisionObject3D ) static1

Creates a new GLTFPhysicsBody instance from the given Godot CollisionObject3D node.


Dictionary to_dictionary ( ) const2

Serializes this GLTFPhysicsBody instance into a Dictionary. It will be in the format expected by the OMI_physics_body glTF extension.


CollisionObject3D to_node ( ) const2

Converts this GLTFPhysicsBody instance into a Godot CollisionObject3D node.

3

本方法通常需要用户覆盖才能生效。

2

本方法无副作用,不会修改该实例的任何成员变量。

4

本方法除了能接受在此处描述的参数外,还能够继续接受任意数量的参数。

5

本方法用于构造某个类型。

1

调用本方法无需实例,可直接使用类名进行调用。

6

本方法描述的是使用本类型作为左操作数的有效运算符。

7

这个值是由下列位标志构成位掩码的整数。

8

无返回值。