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.

GLTFPhysicsBody

Inherits: Resource < RefCounted < Object

Represents a GLTF physics body.

描述

Represents a physics body as defined by the OMI_physics_body GLTF extension. This class is an intermediary between the 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)

String

body_type

"static"

Vector3

center_of_mass

Vector3(0, 0, 0)

Basis

inertia_tensor

Basis(0, 0, 0, 0, 0, 0, 0, 0, 0)

Vector3

linear_velocity

Vector3(0, 0, 0)

float

mass

1.0

Methods

GLTFPhysicsBody

from_dictionary ( Dictionary dictionary ) static

GLTFPhysicsBody

from_node ( CollisionObject3D body_node ) static

Dictionary

to_dictionary ( ) const

CollisionObject3D

to_node ( ) const


Property Descriptions

Vector3 angular_velocity = Vector3(0, 0, 0)

  • void set_angular_velocity ( Vector3 value )

  • 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 = "static"

  • void set_body_type ( String value )

  • 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", "kinematic", "character", "rigid", "vehicle", and "trigger".


Vector3 center_of_mass = Vector3(0, 0, 0)

  • void set_center_of_mass ( Vector3 value )

  • 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.


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

  • void set_inertia_tensor ( Basis value )

  • 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 ( Vector3 value )

  • 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 ( float value )

  • float get_mass ( )

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


Method Descriptions

GLTFPhysicsBody from_dictionary ( Dictionary dictionary ) static

Creates a new GLTFPhysicsBody instance by parsing the given Dictionary.


GLTFPhysicsBody from_node ( CollisionObject3D body_node ) static

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


Dictionary to_dictionary ( ) const

Serializes this GLTFPhysicsBody instance into a Dictionary.


CollisionObject3D to_node ( ) const

Converts this GLTFPhysicsBody instance into a Godot CollisionObject3D node.