Table of Contents

Class GltfPhysicsBody

Namespace
Godot
Assembly
GodotSharp.dll

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.

[GodotClassName("GLTFPhysicsBody")]
public class GltfPhysicsBody : Resource, IDisposable
Inheritance
GltfPhysicsBody
Implements
Inherited Members

Constructors

GltfPhysicsBody()

public GltfPhysicsBody()

Properties

AngularVelocity

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

public Vector3 AngularVelocity { get; set; }

Property Value

Vector3

BodyType

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.

public string BodyType { get; set; }

Property Value

string

CenterOfMass

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.

public Vector3 CenterOfMass { get; set; }

Property Value

Vector3

InertiaDiagonal

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.

public Vector3 InertiaDiagonal { get; set; }

Property Value

Vector3

InertiaOrientation

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 InertiaDiagonal is set to a non-zero value.

public Quaternion InertiaOrientation { get; set; }

Property Value

Quaternion

InertiaTensor

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.

[Obsolete("This property is deprecated.")]
public Basis InertiaTensor { get; set; }

Property Value

Basis

LinearVelocity

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

public Vector3 LinearVelocity { get; set; }

Property Value

Vector3

Mass

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

public float Mass { get; set; }

Property Value

float

Methods

FromDictionary(Dictionary)

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

public static GltfPhysicsBody FromDictionary(Dictionary dictionary)

Parameters

dictionary Dictionary

Returns

GltfPhysicsBody

FromNode(CollisionObject3D)

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

public static GltfPhysicsBody FromNode(CollisionObject3D bodyNode)

Parameters

bodyNode CollisionObject3D

Returns

GltfPhysicsBody

HasGodotClassMethod(in godot_string_name)

Check if the type contains a method with the given name. This method is used by Godot to check if a method exists before invoking it. Do not call or override this method.

protected override bool HasGodotClassMethod(in godot_string_name method)

Parameters

method godot_string_name

Name of the method to check for.

Returns

bool

HasGodotClassSignal(in godot_string_name)

Check if the type contains a signal with the given name. This method is used by Godot to check if a signal exists before raising it. Do not call or override this method.

protected override bool HasGodotClassSignal(in godot_string_name signal)

Parameters

signal godot_string_name

Name of the signal to check for.

Returns

bool

InvokeGodotClassMethod(in godot_string_name, NativeVariantPtrArgs, out godot_variant)

Invokes the method with the given name, using the given arguments. This method is used by Godot to invoke methods from the engine side. Do not call or override this method.

protected override bool InvokeGodotClassMethod(in godot_string_name method, NativeVariantPtrArgs args, out godot_variant ret)

Parameters

method godot_string_name

Name of the method to invoke.

args NativeVariantPtrArgs

Arguments to use with the invoked method.

ret godot_variant

Value returned by the invoked method.

Returns

bool

ToDictionary()

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

public Dictionary ToDictionary()

Returns

Dictionary

ToNode()

Converts this GLTFPhysicsBody instance into a Godot CollisionObject3D node.

public CollisionObject3D ToNode()

Returns

CollisionObject3D