CollisionObject3D
A base 3D physics collision object.
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.
Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.
Properties6
CollisionLayerProperty
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
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
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
public CollisionObject3D.DisableModeEnum DisableMode { get; set; }Defines the behavior in physics when Entity.ProcessMode is set to Entity.ProcessModeEnum.Disabled.
InputCaptureOnDragProperty
public bool InputCaptureOnDrag { get; set; }If true, the CollisionObject3D will continue to receive input events as the mouse is dragged across its shapes.
InputRayPickableProperty
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
public uint CreateShapeOwner(ReckfellObject owner);Creates a new shape owner for the given object. Returns owner_id of the new owner for future reference.
| Name | Type | Default |
|---|---|---|
owner | ReckfellObject | — |
uintGetCaptureInputOnDragbool
public bool GetCaptureInputOnDrag();boolGetCollisionLayeruint
public uint GetCollisionLayer();uintGetCollisionLayerValuebool
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.
| Name | Type | Default |
|---|---|---|
layerNumber | int | — |
boolGetCollisionMaskuint
public uint GetCollisionMask();uintGetCollisionMaskValuebool
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.
| Name | Type | Default |
|---|---|---|
layerNumber | int | — |
boolGetCollisionPriorityfloat
public float GetCollisionPriority();floatGetDisableModeCollisionObject3D.DisableModeEnum
public CollisionObject3D.DisableModeEnum GetDisableMode();CollisionObject3D.DisableModeEnumGetShapeOwnersint[]
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.
int[]IsRayPickablebool
public bool IsRayPickable();boolIsShapeOwnerDisabledbool
public bool IsShapeOwnerDisabled(uint ownerId);If true, the shape owner and its shapes are disabled.
| Name | Type | Default |
|---|---|---|
ownerId | uint | — |
boolRemoveShapeOwnervoid
public void RemoveShapeOwner(uint ownerId);Removes the given shape owner.
| Name | Type | Default |
|---|---|---|
ownerId | uint | — |
SetCaptureInputOnDragvoid
public void SetCaptureInputOnDrag(bool enable);| Name | Type | Default |
|---|---|---|
enable | bool | — |
SetCollisionLayervoid
public void SetCollisionLayer(uint layer);| Name | Type | Default |
|---|---|---|
layer | uint | — |
SetCollisionLayerValuevoid
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.
| Name | Type | Default |
|---|---|---|
layerNumber | int | — |
value | bool | — |
SetCollisionMaskvoid
public void SetCollisionMask(uint mask);| Name | Type | Default |
|---|---|---|
mask | uint | — |
SetCollisionMaskValuevoid
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.
| Name | Type | Default |
|---|---|---|
layerNumber | int | — |
value | bool | — |
SetCollisionPriorityvoid
public void SetCollisionPriority(float priority);| Name | Type | Default |
|---|---|---|
priority | float | — |
SetDisableModevoid
public void SetDisableMode(CollisionObject3D.DisableModeEnum mode);| Name | Type | Default |
|---|---|---|
mode | CollisionObject3D.DisableModeEnum | — |
SetRayPickablevoid
public void SetRayPickable(bool rayPickable);| Name | Type | Default |
|---|---|---|
rayPickable | bool | — |
ShapeFindOwneruint
public uint ShapeFindOwner(int shapeIndex);Returns the owner_id of the given shape.
| Name | Type | Default |
|---|---|---|
shapeIndex | int | — |
uintShapeOwnerAddShapevoid
public void ShapeOwnerAddShape(uint ownerId, Shape3D shape);Adds a Shape3D to the shape owner.
| Name | Type | Default |
|---|---|---|
ownerId | uint | — |
shape | Shape3D | — |
ShapeOwnerClearShapesvoid
public void ShapeOwnerClearShapes(uint ownerId);Removes all shapes from the shape owner.
| Name | Type | Default |
|---|---|---|
ownerId | uint | — |
ShapeOwnerGetOwnerReckfellObject
public ReckfellObject ShapeOwnerGetOwner(uint ownerId);Returns the parent object of the given shape owner.
| Name | Type | Default |
|---|---|---|
ownerId | uint | — |
ReckfellObjectShapeOwnerGetShapeShape3D
public Shape3D ShapeOwnerGetShape(uint ownerId, int shapeId);Returns the Shape3D with the given ID from the given shape owner.
| Name | Type | Default |
|---|---|---|
ownerId | uint | — |
shapeId | int | — |
Shape3DShapeOwnerGetShapeCountint
public int ShapeOwnerGetShapeCount(uint ownerId);Returns the number of shapes the given shape owner contains.
| Name | Type | Default |
|---|---|---|
ownerId | uint | — |
intShapeOwnerGetShapeIndexint
public int ShapeOwnerGetShapeIndex(uint ownerId, int shapeId);Returns the child index of the Shape3D with the given ID from the given shape owner.
| Name | Type | Default |
|---|---|---|
ownerId | uint | — |
shapeId | int | — |
intShapeOwnerGetTransformTransform3D
public Transform3D ShapeOwnerGetTransform(uint ownerId);Returns the shape owner's Transform3D.
| Name | Type | Default |
|---|---|---|
ownerId | uint | — |
Transform3DShapeOwnerRemoveShapevoid
public void ShapeOwnerRemoveShape(uint ownerId, int shapeId);Removes a shape from the given shape owner.
| Name | Type | Default |
|---|---|---|
ownerId | uint | — |
shapeId | int | — |
ShapeOwnerSetDisabledvoid
public void ShapeOwnerSetDisabled(uint ownerId, bool disabled);If true, disables the given shape owner.
| Name | Type | Default |
|---|---|---|
ownerId | uint | — |
disabled | bool | — |
ShapeOwnerSetTransformvoid
public void ShapeOwnerSetTransform(uint ownerId, Transform3D transform);Sets the Transform3D of the given shape owner.
| Name | Type | Default |
|---|---|---|
ownerId | uint | — |
transform | Transform3D | — |
_InputEventvoid
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.
| Name | Type | Default |
|---|---|---|
camera | Camera3D | — |
event | InputEvent | — |
eventPosition | Vector3 | — |
normal | Vector3 | — |
shapeIdx | int | — |
_MouseEntervoid
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
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
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.
| Name | Type | Default |
|---|---|---|
camera | Entity | — |
event | InputEvent | — |
eventPosition | Vector3 | — |
normal | Vector3 | — |
shapeIdx | long | — |
MouseEnteredEvent
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
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
| Value | Description |
|---|---|
KeepActive = 2 | When |
MakeStatic = 1 | When |
Remove = 0 | When |