Base node for collision objects.
    public abstract class CollisionObject : Spatial

CollisionObject is the base class for physics objects. It can hold any number of collision Shapes. Each shape must be assigned to a shape owner. The CollisionObject can have any number of shape owners. Shape owners are not nodes and do not appear in the editor, but are accessible through code using the shape_owner_* methods.

Inheritance Chain

Derived Classes

Signals

    "input_event" (Node camera, InputEvent event, Vector3 click_position, Vector3 click_normal, int shape_idx)

Emitted when _InputEvent(Godot.Object, Godot.InputEvent, Godot.Vector3, Godot.Vector3, int) receives an event. See its description for details.

    "mouse_entered" ()

Emitted when the mouse pointer enters any of this object’s shapes.

    "mouse_exited" ()

Emitted when the mouse pointer exits all this object’s shapes.

Properties

    public bool InputCaptureOnDrag { get; set; }

If true, the CollisionObject will continue to receive input events as the mouse is dragged across its shapes. Default value: false.

    public bool InputRayPickable { get; set; }

If true, the CollisionObject’s shapes will respond to RayCasts. Default value: true.

Methods

    public virtual void _InputEvent(Object camera, InputEvent @event, Vector3 clickPosition, Vector3 clickNormal, int shapeIdx)

Accepts unhandled InputEvents. clickPosition is the clicked location in world space and clickNormal is the normal vector extending from the clicked surface of the Shape at shapeIdx. Connect to the input_event signal to easily pick up these events.

    public int CreateShapeOwner(Object owner)

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

    public bool GetCaptureInputOnDrag()

Getter for InputCaptureOnDrag

    public RID GetRid()

Returns the object’s RID.

    public Godot.Collections.Array GetShapeOwners()

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

    public bool IsRayPickable()

Getter for InputRayPickable

    public bool IsShapeOwnerDisabled(int ownerId)

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

    public void RemoveShapeOwner(int ownerId)

Removes the given shape owner.

    public void SetCaptureInputOnDrag(bool enable)

Setter for InputCaptureOnDrag

    public void SetRayPickable(bool rayPickable)

Setter for InputRayPickable

    public int ShapeFindOwner(int shapeIndex)

Returns the owner_id of the given shape.

    public void ShapeOwnerAddShape(int ownerId, Shape shape)

Adds a Shape to the shape owner.

    public void ShapeOwnerClearShapes(int ownerId)

Removes all shapes from the shape owner.

    public Object ShapeOwnerGetOwner(int ownerId)

Returns the parent object of the given shape owner.

    public Shape ShapeOwnerGetShape(int ownerId, int shapeId)

Returns the Shape with the given id from the given shape owner.

    public int ShapeOwnerGetShapeCount(int ownerId)

Returns the number of shapes the given shape owner contains.

    public int ShapeOwnerGetShapeIndex(int ownerId, int shapeId)

Returns the child index of the Shape with the given id from the given shape owner.

    public Transform ShapeOwnerGetTransform(int ownerId)

Returns the shape owner’s Transform.

    public void ShapeOwnerRemoveShape(int ownerId, int shapeId)

Removes a shape from the given shape owner.

    public void ShapeOwnerSetDisabled(int ownerId, bool disabled)

If true, disables the given shape owner.

    public void ShapeOwnerSetTransform(int ownerId, Transform transform)

Sets the Transform of the given shape owner.

Tags: