reckfellENGINE

GltfPhysicsShape

Represents a glTF physics shape.

On this page
class GltfPhysicsShapeReckfellSharpInherits Resource

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
# GltfPhysicsShape
C#
public GltfPhysicsShape();

Properties7

HeightProperty
# Height
C#
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
# ImporterMesh
C#
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
# IsTrigger
C#
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
# MeshIndex
C#
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
# Radius
C#
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
# ShapeType
C#
public string ShapeType { get; set; }

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

SizeProperty
# Size
C#
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
# FromDictionary
C#
public static GltfPhysicsShape FromDictionary(Reckfell.Collections.Dictionary dictionary);

Creates a new GLTFPhysicsShape instance by parsing the given Reckfell.Collections.Dictionary.

Parameters
NameTypeDefault
dictionaryReckfell.Collections.Dictionary—
Returns GltfPhysicsShape
FromNodeGltfPhysicsShape
# FromNode
C#
public static GltfPhysicsShape FromNode(CollisionShape3D shapeNode);

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

Parameters
NameTypeDefault
shapeNodeCollisionShape3D—
Returns GltfPhysicsShape
FromResourceGltfPhysicsShape
# FromResource
C#
public static GltfPhysicsShape FromResource(Shape3D shapeResource);

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

Parameters
NameTypeDefault
shapeResourceShape3D—
Returns GltfPhysicsShape
GetHeightfloat
# GetHeight
C#
public float GetHeight();
Returns float
GetImporterMeshImporterMesh
# GetImporterMesh
C#
public ImporterMesh GetImporterMesh();
Returns ImporterMesh
GetIsTriggerbool
# GetIsTrigger
C#
public bool GetIsTrigger();
Returns bool
GetMeshIndexint
# GetMeshIndex
C#
public int GetMeshIndex();
Returns int
GetRadiusfloat
# GetRadius
C#
public float GetRadius();
Returns float
GetShapeTypestring
# GetShapeType
C#
public string GetShapeType();
Returns string
GetSizeVector3
# GetSize
C#
public Vector3 GetSize();
Returns Vector3
SetHeightvoid
# SetHeight
C#
public void SetHeight(float height);
Parameters
NameTypeDefault
heightfloat—
SetImporterMeshvoid
# SetImporterMesh
C#
public void SetImporterMesh(ImporterMesh importerMesh);
Parameters
NameTypeDefault
importerMeshImporterMesh—
SetIsTriggervoid
# SetIsTrigger
C#
public void SetIsTrigger(bool isTrigger);
Parameters
NameTypeDefault
isTriggerbool—
SetMeshIndexvoid
# SetMeshIndex
C#
public void SetMeshIndex(int meshIndex);
Parameters
NameTypeDefault
meshIndexint—
SetRadiusvoid
# SetRadius
C#
public void SetRadius(float radius);
Parameters
NameTypeDefault
radiusfloat—
SetShapeTypevoid
# SetShapeType
C#
public void SetShapeType(string shapeType);
Parameters
NameTypeDefault
shapeTypestring—
SetSizevoid
# SetSize
C#
public void SetSize(Vector3 size);
Parameters
NameTypeDefault
sizeVector3—
ToDictionaryReckfell.Collections.Dictionary
# ToDictionary
C#
public Reckfell.Collections.Dictionary ToDictionary();

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

Returns Reckfell.Collections.Dictionary
ToNodeCollisionShape3D
# ToNode
C#
public CollisionShape3D ToNode(bool cacheShapes = false);

Converts this GLTFPhysicsShape instance into a Reckfell CollisionShape3D node.

Parameters
NameTypeDefault
cacheShapesboolfalse
Returns CollisionShape3D
ToResourceShape3D
# ToResource
C#
public Shape3D ToResource(bool cacheShapes = false);

Converts this GLTFPhysicsShape instance into a Reckfell Shape3D resource.

Parameters
NameTypeDefault
cacheShapesboolfalse
Returns Shape3D
Reckfell Engine documentationBack to top ↑
QUICK LINKSGetting startedEntity hierarchyC# & .NET 10Scenes and prefabs
Reckfell guides and full API K
reckfellENGINE
RECKFELL ACCOUNT

Sign in

Sign in to your Reckfell account.

One account for the entire Reckfell platform.