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
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
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
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
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
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
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
Methods
FromDictionary(Dictionary)
Creates a new GLTFPhysicsShape instance by parsing the given Dictionary.
public static GltfPhysicsShape FromDictionary(Dictionary dictionary)
Parameters
dictionary
Dictionary
Returns
FromNode(CollisionShape3D)
Creates a new GLTFPhysicsShape instance from the given Godot CollisionShape3D node.
public static GltfPhysicsShape FromNode(CollisionShape3D shapeNode)
Parameters
shapeNode
CollisionShape3D
Returns
FromResource(Shape3D)
Creates a new GLTFPhysicsShape instance from the given Godot Shape3D resource.
public static GltfPhysicsShape FromResource(Shape3D shapeResource)
Parameters
shapeResource
Shape3D
Returns
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_nameName of the method to check for.
Returns
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_nameName of the signal to check for.
Returns
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_nameName of the method to invoke.
args
NativeVariantPtrArgsArguments to use with the invoked method.
ret
godot_variantValue returned by the invoked method.
Returns
ToDictionary()
Serializes this GLTFPhysicsShape instance into a Dictionary in the format defined by OMI_physics_shape
.
public Dictionary ToDictionary()
Returns
ToNode(bool)
Converts this GLTFPhysicsShape instance into a Godot CollisionShape3D node.
public CollisionShape3D ToNode(bool cacheShapes = false)
Parameters
cacheShapes
bool
Returns
ToResource(bool)
Converts this GLTFPhysicsShape instance into a Godot Shape3D resource.
public Shape3D ToResource(bool cacheShapes = false)
Parameters
cacheShapes
bool