reckfellENGINE

CollisionObject3D

A base 3D physics collision object.

On this page
class CollisionObject3DReckfellSharpInherits Entity3D

Bodies and areas inherit CollisionObject3D. Child CollisionShapes and Shape resources define geometry; visible sprites/meshes do not create it automatically. Layer defines membership; Mask filters detection/interaction.

Layer number 3 corresponds to bit value 4. SetCollisionLayerValue/SetCollisionMaskValue accept a number from 1–32, not a bitmask. Use GetRid for ray exclusion, not GetInstanceId. A query shape index refers to physics shapes, not an arbitrary hierarchy child index.

Guide and example.

Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.

Properties6

CollisionLayerProperty
# CollisionLayer
C#
public uint CollisionLayer { get; set; }

The physics layers this CollisionObject3D is in. Collision objects can exist in one or more of 32 different layers. See also CollisionObject3D.CollisionMask. For an easier way to change this value from a script, see CollisionObject3D.SetCollisionLayerValue. Note: Object A can detect a contact with object B only if object B is in any of the layers that object A scans. See Collision layers and masks in the documentation for more information.

CollisionMaskProperty
# CollisionMask
C#
public uint CollisionMask { get; set; }

The physics layers this CollisionObject3D scans. Collision objects can scan one or more of 32 different layers. See also CollisionObject3D.CollisionLayer. For an easier way to change this value from a script, see CollisionObject3D.SetCollisionMaskValue. Note: Object A can detect a contact with object B only if object B is in any of the layers that object A scans. See Collision layers and masks in the documentation for more information.

CollisionPriorityProperty
# CollisionPriority
C#
public float CollisionPriority { get; set; }

The priority used to solve colliding when occurring penetration. The higher the priority is, the lower the penetration into the object will be. This can for example be used to prevent the player from breaking through the boundaries of a level.

DisableModeProperty
# DisableMode
C#
public CollisionObject3D.DisableModeEnum DisableMode { get; set; }

Defines the behavior in physics when Entity.ProcessMode is set to Entity.ProcessModeEnum.Disabled.

InputCaptureOnDragProperty
# InputCaptureOnDrag
C#
public bool InputCaptureOnDrag { get; set; }

If true, the CollisionObject3D will continue to receive input events as the mouse is dragged across its shapes.

InputRayPickableProperty
# InputRayPickable
C#
public bool InputRayPickable { get; set; }

If true, this object is pickable. A pickable object can detect the mouse pointer entering/leaving, and if the mouse is inside it, report input events. Requires at least one CollisionObject3D.CollisionLayer bit to be set.

Methods35

CreateShapeOwneruint
# CreateShapeOwner
C#
public uint CreateShapeOwner(ReckfellObject owner);

Creates a new shape owner for the given object. Returns owner_id of the new owner for future reference.

Parameters
NameTypeDefault
ownerReckfellObject—
Returns uint
GetCaptureInputOnDragbool
# GetCaptureInputOnDrag
C#
public bool GetCaptureInputOnDrag();
Returns bool
GetCollisionLayeruint
# GetCollisionLayer
C#
public uint GetCollisionLayer();
Returns uint
GetCollisionLayerValuebool
# GetCollisionLayerValue
C#
public bool GetCollisionLayerValue(int layerNumber);

Returns whether or not the specified layer of the CollisionObject3D.CollisionLayer is enabled, given a layer_number between 1 and 32.

Parameters
NameTypeDefault
layerNumberint—
Returns bool
GetCollisionMaskuint
# GetCollisionMask
C#
public uint GetCollisionMask();
Returns uint
GetCollisionMaskValuebool
# GetCollisionMaskValue
C#
public bool GetCollisionMaskValue(int layerNumber);

Returns whether or not the specified layer of the CollisionObject3D.CollisionMask is enabled, given a layer_number between 1 and 32.

Parameters
NameTypeDefault
layerNumberint—
Returns bool
GetCollisionPriorityfloat
# GetCollisionPriority
C#
public float GetCollisionPriority();
Returns float
GetDisableModeCollisionObject3D.DisableModeEnum
# GetDisableMode
C#
public CollisionObject3D.DisableModeEnum GetDisableMode();
Returns CollisionObject3D.DisableModeEnum
GetRidRid
# GetRid
C#
public Rid GetRid();

Returns the object's Rid.

Returns Rid
GetShapeOwnersint[]
# GetShapeOwners
C#
public int[] GetShapeOwners();

Returns an Reckfell.Collections.Array of owner_id identifiers. You can use these ids in other methods that take owner_id as an argument.

Returns int[]
IsRayPickablebool
# IsRayPickable
C#
public bool IsRayPickable();
Returns bool
IsShapeOwnerDisabledbool
# IsShapeOwnerDisabled
C#
public bool IsShapeOwnerDisabled(uint ownerId);

If true, the shape owner and its shapes are disabled.

Parameters
NameTypeDefault
ownerIduint—
Returns bool
RemoveShapeOwnervoid
# RemoveShapeOwner
C#
public void RemoveShapeOwner(uint ownerId);

Removes the given shape owner.

Parameters
NameTypeDefault
ownerIduint—
SetCaptureInputOnDragvoid
# SetCaptureInputOnDrag
C#
public void SetCaptureInputOnDrag(bool enable);
Parameters
NameTypeDefault
enablebool—
SetCollisionLayervoid
# SetCollisionLayer
C#
public void SetCollisionLayer(uint layer);
Parameters
NameTypeDefault
layeruint—
SetCollisionLayerValuevoid
# SetCollisionLayerValue
C#
public void SetCollisionLayerValue(int layerNumber, bool value);

Changes membership by layer number 1–32. Number 3 changes bit value 4; pass the number, not a precomputed mask.

Parameters
NameTypeDefault
layerNumberint—
valuebool—
SetCollisionMaskvoid
# SetCollisionMask
C#
public void SetCollisionMask(uint mask);
Parameters
NameTypeDefault
maskuint—
SetCollisionMaskValuevoid
# SetCollisionMaskValue
C#
public void SetCollisionMaskValue(int layerNumber, bool value);

Changes filtering by layer number 1–32. Mask and Layer have different roles; this does not edit geometry or every other object's filters.

Parameters
NameTypeDefault
layerNumberint—
valuebool—
SetCollisionPriorityvoid
# SetCollisionPriority
C#
public void SetCollisionPriority(float priority);
Parameters
NameTypeDefault
priorityfloat—
SetDisableModevoid
# SetDisableMode
C#
public void SetDisableMode(CollisionObject3D.DisableModeEnum mode);
Parameters
NameTypeDefault
modeCollisionObject3D.DisableModeEnum—
SetRayPickablevoid
# SetRayPickable
C#
public void SetRayPickable(bool rayPickable);
Parameters
NameTypeDefault
rayPickablebool—
ShapeFindOwneruint
# ShapeFindOwner
C#
public uint ShapeFindOwner(int shapeIndex);

Returns the owner_id of the given shape.

Parameters
NameTypeDefault
shapeIndexint—
Returns uint
ShapeOwnerAddShapevoid
# ShapeOwnerAddShape
C#
public void ShapeOwnerAddShape(uint ownerId, Shape3D shape);

Adds a Shape3D to the shape owner.

Parameters
NameTypeDefault
ownerIduint—
shapeShape3D—
ShapeOwnerClearShapesvoid
# ShapeOwnerClearShapes
C#
public void ShapeOwnerClearShapes(uint ownerId);

Removes all shapes from the shape owner.

Parameters
NameTypeDefault
ownerIduint—
ShapeOwnerGetOwnerReckfellObject
# ShapeOwnerGetOwner
C#
public ReckfellObject ShapeOwnerGetOwner(uint ownerId);

Returns the parent object of the given shape owner.

Parameters
NameTypeDefault
ownerIduint—
Returns ReckfellObject
ShapeOwnerGetShapeShape3D
# ShapeOwnerGetShape
C#
public Shape3D ShapeOwnerGetShape(uint ownerId, int shapeId);

Returns the Shape3D with the given ID from the given shape owner.

Parameters
NameTypeDefault
ownerIduint—
shapeIdint—
Returns Shape3D
ShapeOwnerGetShapeCountint
# ShapeOwnerGetShapeCount
C#
public int ShapeOwnerGetShapeCount(uint ownerId);

Returns the number of shapes the given shape owner contains.

Parameters
NameTypeDefault
ownerIduint—
Returns int
ShapeOwnerGetShapeIndexint
# ShapeOwnerGetShapeIndex
C#
public int ShapeOwnerGetShapeIndex(uint ownerId, int shapeId);

Returns the child index of the Shape3D with the given ID from the given shape owner.

Parameters
NameTypeDefault
ownerIduint—
shapeIdint—
Returns int
ShapeOwnerGetTransformTransform3D
# ShapeOwnerGetTransform
C#
public Transform3D ShapeOwnerGetTransform(uint ownerId);

Returns the shape owner's Transform3D.

Parameters
NameTypeDefault
ownerIduint—
Returns Transform3D
ShapeOwnerRemoveShapevoid
# ShapeOwnerRemoveShape
C#
public void ShapeOwnerRemoveShape(uint ownerId, int shapeId);

Removes a shape from the given shape owner.

Parameters
NameTypeDefault
ownerIduint—
shapeIdint—
ShapeOwnerSetDisabledvoid
# ShapeOwnerSetDisabled
C#
public void ShapeOwnerSetDisabled(uint ownerId, bool disabled);

If true, disables the given shape owner.

Parameters
NameTypeDefault
ownerIduint—
disabledbool—
ShapeOwnerSetTransformvoid
# ShapeOwnerSetTransform
C#
public void ShapeOwnerSetTransform(uint ownerId, Transform3D transform);

Sets the Transform3D of the given shape owner.

Parameters
NameTypeDefault
ownerIduint—
transformTransform3D—
_InputEventvoid
# _InputEvent
C#
public virtual void _InputEvent(Camera3D camera, InputEvent @event, Vector3 eventPosition, Vector3 normal, int shapeIdx);

Detects unhandled mouse and touch InputEvents through event when they happen while hovering over the object. Gesture events are not detected. camera is the Camera3D that the event originated in (for cameras inside viewports other than the main one to be detected, the parent Viewport.PhysicsObjectPicking needs to be set to true). event_position is the position hit by a raycast from the camera to the mouse, in global space. normal is the normal vector of the surface at that point in world space. shape_idx is the index of the detected shape from PhysicsServer3D. See also Entity._UnhandledInput, CollisionObject3D.ShapeFindOwner, and CollisionObject3D.ShapeOwnerGetOwner. Note: InputEventScreenDrag events are triggered if the drag events started while hovering the object, or when the object is in the path of the drag event. Note: CollisionObject3D.InputEvent requires CollisionObject3D.InputRayPickable to be true and at least one CollisionObject3D.CollisionLayer bit to be set.

Parameters
NameTypeDefault
cameraCamera3D—
eventInputEvent—
eventPositionVector3—
normalVector3—
shapeIdxint—
_MouseEntervoid
# _MouseEnter
C#
public virtual void _MouseEnter();

Called when the mouse pointer enters any of this object's shapes. Requires CollisionObject3D.InputRayPickable to be true and at least one CollisionObject3D.CollisionLayer bit to be set. Note that moving between different shapes within a single CollisionObject3D won't cause this function to be called.

_MouseExitvoid
# _MouseExit
C#
public virtual void _MouseExit();

Called when the mouse pointer exits all this object's shapes. Requires CollisionObject3D.InputRayPickable to be true and at least one CollisionObject3D.CollisionLayer bit to be set. Note that moving between different shapes within a single CollisionObject3D won't cause this function to be called.

Signals and events3

InputEventEvent
# InputEvent
C#
public event CollisionObject3D.InputEventEventHandler InputEvent;

Detects unhandled mouse and touch InputEvents through event when they happen while hovering over the object. Gesture events are not detected. camera is the Camera3D that the event originated in (for cameras inside viewports other than the main one to be detected, the parent Viewport.PhysicsObjectPicking needs to be set to true). event_position is the position hit by a raycast from the camera to the mouse, in global space. normal is the normal vector of the surface at that point in world space. shape_idx is the index of the detected shape from PhysicsServer3D. See also Entity._UnhandledInput, CollisionObject3D.ShapeFindOwner, and CollisionObject3D.ShapeOwnerGetOwner. Note: InputEventScreenDrag events are triggered if the drag events started while hovering the object, or when the object is in the path of the drag event. Note: CollisionObject3D.InputEvent requires CollisionObject3D.InputRayPickable to be true and at least one CollisionObject3D.CollisionLayer bit to be set.

Handler parameters
NameTypeDefault
cameraEntity—
eventInputEvent—
eventPositionVector3—
normalVector3—
shapeIdxlong—
MouseEnteredEvent
# MouseEntered
C#
public event Action MouseEntered;

Emitted when the mouse pointer enters any of this object's shapes. Requires CollisionObject3D.InputRayPickable to be true and at least one CollisionObject3D.CollisionLayer bit to be set. Note: Due to the lack of continuous collision detection, this signal may not be emitted in the expected order if the mouse moves fast enough and the CollisionObject3D's area is small. This signal may also not be emitted if another CollisionObject3D is overlapping the CollisionObject3D in question.

MouseExitedEvent
# MouseExited
C#
public event Action MouseExited;

Emitted when the mouse pointer exits all this object's shapes. Requires CollisionObject3D.InputRayPickable to be true and at least one CollisionObject3D.CollisionLayer bit to be set. Note: Due to the lack of continuous collision detection, this signal may not be emitted in the expected order if the mouse moves fast enough and the CollisionObject3D's area is small. This signal may also not be emitted if another CollisionObject3D is overlapping the CollisionObject3D in question.

CollisionObject3D.DisableModeEnum

ValueDescription
KeepActive = 2

When Entity.ProcessMode is set to Entity.ProcessModeEnum.Disabled, do not affect the physics simulation.

MakeStatic = 1

When Entity.ProcessMode is set to Entity.ProcessModeEnum.Disabled, make the body static. Doesn't affect Area3D. PhysicsBody3D can't be affected by forces or other bodies while static. Automatically set PhysicsBody3D back to its original mode when the Entity is processed again.

Remove = 0

When Entity.ProcessMode is set to Entity.ProcessModeEnum.Disabled, remove from the physics simulation to stop all physics interactions with this CollisionObject3D. Automatically re-added to the physics simulation when the Entity is processed again.

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.