Class reference
GLTFPhysicsBody
Inherits Resource
Represents a glTF physics body.
Description
Represents a physics body as an intermediary between the OMI_physics_body glTF data and Redot's nodes, and it's abstracted in a way that allows adding support for different glTF physics extensions in the future.
Properties
Vector3 angular_velocity = Vector3(0, 0, 0)
Vector3 angular_velocity = Vector3(0, 0, 0)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"
String body_type = "rigid"The type of the body. When importing, this controls what type of CollisionObject3D node Redot 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)
Vector3 center_of_mass = Vector3(0, 0, 0)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)
Vector3 inertia_diagonal = Vector3(0, 0, 0)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 Redot RigidBody3D node, if this value is zero, then the inertia will be calculated automatically.
Quaternion inertia_orientation = Quaternion(0, 0, 0, 1)
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)
Basis inertia_tensor = Basis(0, 0, 0, 0, 0, 0, 0, 0, 0)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 Redot RigidBody3D node, if this value is zero, then the inertia will be calculated automatically.
Vector3 linear_velocity = Vector3(0, 0, 0)
Vector3 linear_velocity = Vector3(0, 0, 0)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
float mass = 1.0The mass of the physics body, in kilograms. This is only used when the body type is "rigid" or "vehicle".
Methods
GLTFPhysicsBody from_dictionary(Dictionary dictionary) static
GLTFPhysicsBody from_dictionary(Dictionary dictionary) staticCreates a new GLTFPhysicsBody instance by parsing the given Dictionary in the OMI_physics_body glTF extension format.
GLTFPhysicsBody from_node(CollisionObject3D body_node) static
GLTFPhysicsBody from_node(CollisionObject3D body_node) staticCreates a new GLTFPhysicsBody instance from the given Redot CollisionObject3D node.
Dictionary to_dictionary() const
Dictionary to_dictionary() constSerializes this GLTFPhysicsBody instance into a Dictionary. It will be in the format expected by the OMI_physics_body glTF extension.
CollisionObject3D to_node() const
CollisionObject3D to_node() constConverts this GLTFPhysicsBody instance into a Redot CollisionObject3D node.