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.

GLTFPhysicsShape

Eredita: Resource < RefCounted < Object

Rappresenta una forma fisica glTF.

Descrizione

Rappresenta una forma fisica come definita dalle estensioni glTF OMI_physics_shape o OMI_collider. Questa classe è un intermediario tra i dati glTF e i nodi di Godot, ed è astratta in modo da supportare in futuro diverse estensioni glTF di fisica.

Tutorial

Proprietà

float

height

2.0

ImporterMesh

importer_mesh

bool

is_trigger

false

int

mesh_index

-1

float

radius

0.5

String

shape_type

""

Vector3

size

Vector3(1, 1, 1)

Metodi

GLTFPhysicsShape

from_dictionary(dictionary: Dictionary) static

GLTFPhysicsShape

from_node(shape_node: CollisionShape3D) static

GLTFPhysicsShape

from_resource(shape_resource: Shape3D) static

Dictionary

to_dictionary() const

CollisionShape3D

to_node(cache_shapes: bool = false)

Shape3D

to_resource(cache_shapes: bool = false)


Descrizioni delle proprietà

float height = 2.0 🔗

  • void set_height(value: float)

  • float get_height()

L'altezza della forma, in metri. È utilizzata solo quando il tipo di forma è "capsule" o "cylinder". Questo valore non deve essere negativo, e per "capsule" deve essere almeno il doppio del raggio.


ImporterMesh importer_mesh 🔗

La risorsa ImporterMesh della forma. È utilizzata solo quando il tipo di forma è "hull" (hull convesso) o "trimesh" (trimesh concavo).


bool is_trigger = false 🔗

  • void set_is_trigger(value: bool)

  • bool get_is_trigger()

Se true, indica che questa forma è un trigger. Per Godot, questo significa che la forma dovrebbe essere un figlio di un nodo Area3D.

Questa è l'unica variabile non utilizzata nel metodo to_node(), è pensata per essere utilizzata accanto quando si decide dove aggiungere il nodo generato come figlio.


int mesh_index = -1 🔗

  • void set_mesh_index(value: int)

  • int get_mesh_index()

L'indice della mesh della forma nel file glTF. È utilizzato solo quando il tipo di forma è "hull" (hull convesso) o "trimesh" (trimesh concavo).


float radius = 0.5 🔗

  • void set_radius(value: float)

  • float get_radius()

Il raggio della forma, in metri. È utilizzata solo quando il tipo di forma è "capsule", "cylinder" o "sphere". Questo valore non deve essere negativo.


String shape_type = "" 🔗

  • void set_shape_type(value: String)

  • String get_shape_type()

Il tipo di forma che questa forma rappresenta. I valori validi sono "box", "capsule", "cylinder", "sphere", "hull" e "trimesh".


Vector3 size = Vector3(1, 1, 1) 🔗

Le dimensioni della forma, in metri. Sono utilizzate solo quando il tipo di forma è "box" e rappresentano il diametro ("diameter") del riquadro. Questo valore non deve essere negativo.


Descrizioni dei metodi

GLTFPhysicsShape from_dictionary(dictionary: Dictionary) static 🔗

Crea una nuova istanza di GLTFPhysicsShape elaborando il Dictionary specificato.


GLTFPhysicsShape from_node(shape_node: CollisionShape3D) static 🔗

Crea una nuova istanza di GLTFPhysicsShape dal nodo CollisionShape3D di Godot specificato.


GLTFPhysicsShape from_resource(shape_resource: Shape3D) static 🔗

Crea una nuova istanza di GLTFPhysicsShape dalla risorsa Shape3D di Godot specificata.


Dictionary to_dictionary() const 🔗

Serializza questa istanza di GLTFPhysicsShape in un Dictionary nel formato definito da OMI_physics_shape.


CollisionShape3D to_node(cache_shapes: bool = false) 🔗

Converte questa istanza di GLTFPhysicsShape in un nodo CollisionShape3D di Godot.


Shape3D to_resource(cache_shapes: bool = false) 🔗

Converte questa istanza di GLTFPhysicsShape in una risorsa Shape3D di Godot.