GLTFPhysicsShape

继承: Resource < RefCounted < Object

Represents a glTF physics shape.

描述

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.

属性

方法

GLTFPhysicsShapefrom_dictionary ( dictionary: Dictionary ) static1
GLTFPhysicsShapefrom_node ( shape_node: CollisionShape3D ) static1
GLTFPhysicsShapefrom_resource ( shape_resource: Shape3D ) static1
Dictionaryto_dictionary ( ) const2
CollisionShape3Dto_node ( cache_shapes: bool = false )
Shape3Dto_resource ( cache_shapes: bool = false )

属性说明

float height = 2.0

  • void set_height ( value: float )
  • float get_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.


ImporterMesh importer_mesh

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


bool is_trigger = false

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


int mesh_index = -1

  • void set_mesh_index ( value: int )
  • int get_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).


float radius = 0.5

  • void set_radius ( value: float )
  • float get_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.


String shape_type = ""

  • void set_shape_type ( value: String )
  • String get_shape_type ( )

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


Vector3 size = Vector3(1, 1, 1)

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.


方法说明

GLTFPhysicsShape from_dictionary ( dictionary: Dictionary ) static1

Creates a new GLTFPhysicsShape instance by parsing the given Dictionary.


GLTFPhysicsShape from_node ( shape_node: CollisionShape3D ) static1

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


GLTFPhysicsShape from_resource ( shape_resource: Shape3D ) static1

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


Dictionary to_dictionary ( ) const2

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


CollisionShape3D to_node ( cache_shapes: bool = false )

Converts this GLTFPhysicsShape instance into a Godot CollisionShape3D node.


Shape3D to_resource ( cache_shapes: bool = false )

Converts this GLTFPhysicsShape instance into a Godot Shape3D resource.

3

本方法通常需要用户覆盖才能生效。

2

本方法无副作用,不会修改该实例的任何成员变量。

4

本方法除了能接受在此处描述的参数外,还能够继续接受任意数量的参数。

5

本方法用于构造某个类型。

1

调用本方法无需实例,可直接使用类名进行调用。

6

本方法描述的是使用本类型作为左操作数的有效运算符。

7

这个值是由下列位标志构成位掩码的整数。

8

无返回值。