Table of Contents

Class GLTFPhysicsShape

Represents a glTF physics shape.

Inheritance
GLTFPhysicsShape

Remarks

Represents a physics shape as defined by the OMI_physics_shape or OMI_collider glTF extensions. 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.

See Also

Properties

height

The height of the shape, in meters. This is only used when the shape type is "capsule" or "cylinder". This value should not be negative, and for "capsule" it should be at least twice the radius.

var height : float = 2.0

Property Value

float

Remarks

importer_mesh

The ImporterMesh resource of the shape. This is only used when the shape type is "hull" (convex hull) or "trimesh" (concave trimesh).

var importer_mesh : ImporterMesh

Property Value

ImporterMesh

Remarks

is_trigger

If true, indicates that this shape is a trigger. For Godot, this means that the shape should be a child of an Area3D node.

This is the only variable not used in the GLTFPhysicsShape.to_node method, it's intended to be used alongside when deciding where to add the generated node as a child.

var is_trigger : bool = false

Property Value

bool

Remarks

  • void set_is_trigger(bool value)
  • bool get_is_trigger

mesh_index

The index of the shape's mesh in the glTF file. This is only used when the shape type is "hull" (convex hull) or "trimesh" (concave trimesh).

var mesh_index : int = -1

Property Value

int

Remarks

  • void set_mesh_index(int value)
  • int get_mesh_index

radius

The radius of the shape, in meters. This is only used when the shape type is "capsule", "cylinder", or "sphere". This value should not be negative.

var radius : float = 0.5

Property Value

float

Remarks

shape_type

The type of shape this shape represents. Valid values are "box", "capsule", "cylinder", "sphere", "hull", and "trimesh".

var shape_type : String = ""

Property Value

String

Remarks

size

The size of the shape, in meters. This is only used when the shape type is "box", and it represents the "diameter" of the box. This value should not be negative.

var size : Vector3 = Vector3(1, 1, 1)

Property Value

Vector3

Remarks

Methods

from_dictionary(Dictionary)

Qualifiers: static

Creates a new GLTFPhysicsShape instance by parsing the given Dictionary.

GLTFPhysicsShape from_dictionary(Dictionary dictionary)

Parameters

dictionary Dictionary

from_node(CollisionShape3D)

Qualifiers: static

Creates a new GLTFPhysicsShape instance from the given Godot CollisionShape3D node.

GLTFPhysicsShape from_node(CollisionShape3D shape_node)

Parameters

shape_node CollisionShape3D

from_resource(Shape3D)

Qualifiers: static

Creates a new GLTFPhysicsShape instance from the given Godot Shape3D resource.

GLTFPhysicsShape from_resource(Shape3D shape_resource)

Parameters

shape_resource Shape3D

to_dictionary

Qualifiers: const

Serializes this GLTFPhysicsShape instance into a Dictionary in the format defined by OMI_physics_shape.

Dictionary to_dictionary

to_node(bool)

Converts this GLTFPhysicsShape instance into a Godot CollisionShape3D node.

CollisionShape3D to_node(bool cache_shapes)

Parameters

cache_shapes bool

to_resource(bool)

Converts this GLTFPhysicsShape instance into a Godot Shape3D resource.

Shape3D to_resource(bool cache_shapes)

Parameters

cache_shapes bool