GltfPhysicsShape
Represents a glTF physics shape.
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 Reckfell's nodes, and it's abstracted in a way that allows adding support for different glTF physics extensions in the future.
Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.
Constructors1
GltfPhysicsShapeConstructor
public GltfPhysicsShape();Properties7
HeightProperty
public float Height { get; set; }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.
ImporterMeshProperty
public ImporterMesh ImporterMesh { get; set; }The ImporterMesh resource of the shape. This is only used when the shape type is "hull" (convex hull) or "trimesh" (concave trimesh).
IsTriggerProperty
public bool IsTrigger { get; set; }If true, indicates that this shape is a trigger. For Reckfell, this means that the shape should be a child of an Area3D node.
This is the only variable not used in the GltfPhysicsShape.ToNode method, it's intended to be used alongside when deciding where to add the generated node as a child.
MeshIndexProperty
public int MeshIndex { get; set; }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).
RadiusProperty
public float Radius { get; set; }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.
ShapeTypeProperty
public string ShapeType { get; set; }The type of shape this shape represents. Valid values are "box", "capsule", "cylinder", "sphere", "hull", and "trimesh".
SizeProperty
public Vector3 Size { get; set; }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.
Methods20
FromDictionaryGltfPhysicsShape
public static GltfPhysicsShape FromDictionary(Reckfell.Collections.Dictionary dictionary);Creates a new GLTFPhysicsShape instance by parsing the given Reckfell.Collections.Dictionary.
| Name | Type | Default |
|---|---|---|
dictionary | Reckfell.Collections.Dictionary | — |
GltfPhysicsShapeFromNodeGltfPhysicsShape
public static GltfPhysicsShape FromNode(CollisionShape3D shapeNode);Creates a new GLTFPhysicsShape instance from the given Reckfell CollisionShape3D node.
| Name | Type | Default |
|---|---|---|
shapeNode | CollisionShape3D | — |
GltfPhysicsShapeFromResourceGltfPhysicsShape
public static GltfPhysicsShape FromResource(Shape3D shapeResource);Creates a new GLTFPhysicsShape instance from the given Reckfell Shape3D resource.
| Name | Type | Default |
|---|---|---|
shapeResource | Shape3D | — |
GltfPhysicsShapeGetHeightfloat
public float GetHeight();floatGetImporterMeshImporterMesh
public ImporterMesh GetImporterMesh();ImporterMeshGetIsTriggerbool
public bool GetIsTrigger();boolGetMeshIndexint
public int GetMeshIndex();intGetRadiusfloat
public float GetRadius();floatGetShapeTypestring
public string GetShapeType();stringGetSizeVector3
public Vector3 GetSize();Vector3SetHeightvoid
public void SetHeight(float height);| Name | Type | Default |
|---|---|---|
height | float | — |
SetImporterMeshvoid
public void SetImporterMesh(ImporterMesh importerMesh);| Name | Type | Default |
|---|---|---|
importerMesh | ImporterMesh | — |
SetIsTriggervoid
public void SetIsTrigger(bool isTrigger);| Name | Type | Default |
|---|---|---|
isTrigger | bool | — |
SetMeshIndexvoid
public void SetMeshIndex(int meshIndex);| Name | Type | Default |
|---|---|---|
meshIndex | int | — |
SetRadiusvoid
public void SetRadius(float radius);| Name | Type | Default |
|---|---|---|
radius | float | — |
SetShapeTypevoid
public void SetShapeType(string shapeType);| Name | Type | Default |
|---|---|---|
shapeType | string | — |
SetSizevoid
public void SetSize(Vector3 size);| Name | Type | Default |
|---|---|---|
size | Vector3 | — |
ToDictionaryReckfell.Collections.Dictionary
public Reckfell.Collections.Dictionary ToDictionary();Serializes this GLTFPhysicsShape instance into a Reckfell.Collections.Dictionary in the format defined by OMI_physics_shape.
Reckfell.Collections.DictionaryToNodeCollisionShape3D
public CollisionShape3D ToNode(bool cacheShapes = false);Converts this GLTFPhysicsShape instance into a Reckfell CollisionShape3D node.
| Name | Type | Default |
|---|---|---|
cacheShapes | bool | false |
CollisionShape3DToResourceShape3D
public Shape3D ToResource(bool cacheShapes = false);Converts this GLTFPhysicsShape instance into a Reckfell Shape3D resource.
| Name | Type | Default |
|---|---|---|
cacheShapes | bool | false |
Shape3D