Table of Contents

Class GltfPhysicsShape

Namespace
Godot
Assembly
GodotSharp.dll

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.

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

Constructors

GltfPhysicsShape()

public GltfPhysicsShape()

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.

public float Height { get; set; }

Property Value

float

ImporterMesh

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

public ImporterMesh ImporterMesh { get; set; }

Property Value

ImporterMesh

IsTrigger

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 ToNode(bool) method, it's intended to be used alongside when deciding where to add the generated node as a child.

public bool IsTrigger { get; set; }

Property Value

bool

MeshIndex

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

public int MeshIndex { get; set; }

Property Value

int

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.

public float Radius { get; set; }

Property Value

float

ShapeType

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

public string ShapeType { get; set; }

Property Value

string

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.

public Vector3 Size { get; set; }

Property Value

Vector3

Methods

FromDictionary(Dictionary)

Creates a new GLTFPhysicsShape instance by parsing the given Dictionary.

public static GltfPhysicsShape FromDictionary(Dictionary dictionary)

Parameters

dictionary Dictionary

Returns

GltfPhysicsShape

FromNode(CollisionShape3D)

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

public static GltfPhysicsShape FromNode(CollisionShape3D shapeNode)

Parameters

shapeNode CollisionShape3D

Returns

GltfPhysicsShape

FromResource(Shape3D)

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

public static GltfPhysicsShape FromResource(Shape3D shapeResource)

Parameters

shapeResource Shape3D

Returns

GltfPhysicsShape

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 GLTFPhysicsShape instance into a Dictionary in the format defined by OMI_physics_shape.

public Dictionary ToDictionary()

Returns

Dictionary

ToNode(bool)

Converts this GLTFPhysicsShape instance into a Godot CollisionShape3D node.

public CollisionShape3D ToNode(bool cacheShapes = false)

Parameters

cacheShapes bool

Returns

CollisionShape3D

ToResource(bool)

Converts this GLTFPhysicsShape instance into a Godot Shape3D resource.

public Shape3D ToResource(bool cacheShapes = false)

Parameters

cacheShapes bool

Returns

Shape3D