CollisionObject

Inherits: Spatial < Node < Object

Inherited By: Area, PhysicsBody

Category: Core

Brief Description

Base node for collision objects.

Methods

void _input_event ( Object camera, InputEvent event, Vector3 click_position, Vector3 click_normal, int shape_idx ) virtual
int create_shape_owner ( Object owner )
RID get_rid ( ) const
Array get_shape_owners ( )
bool is_shape_owner_disabled ( int owner_id ) const
void remove_shape_owner ( int owner_id )
int shape_find_owner ( int shape_index ) const
void shape_owner_add_shape ( int owner_id, Shape shape )
void shape_owner_clear_shapes ( int owner_id )
Object shape_owner_get_owner ( int owner_id ) const
Shape shape_owner_get_shape ( int owner_id, int shape_id ) const
int shape_owner_get_shape_count ( int owner_id ) const
int shape_owner_get_shape_index ( int owner_id, int shape_id ) const
Transform shape_owner_get_transform ( int owner_id ) const
void shape_owner_remove_shape ( int owner_id, int shape_id )
void shape_owner_set_disabled ( int owner_id, bool disabled )
void shape_owner_set_transform ( int owner_id, Transform transform )

Signals

Emitted when _input_event 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.

Description

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.

Property Descriptions

  • bool input_capture_on_drag
Setter set_capture_input_on_drag(value)
Getter get_capture_input_on_drag()

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


  • bool input_ray_pickable
Setter set_ray_pickable(value)
Getter is_ray_pickable()

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

Method Descriptions

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


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


  • RID get_rid ( ) const

Returns the object’s RID.


  • Array get_shape_owners ( )

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


  • bool is_shape_owner_disabled ( int owner_id ) const

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


  • void remove_shape_owner ( int owner_id )

Removes the given shape owner.


  • int shape_find_owner ( int shape_index ) const

Returns the owner_id of the given shape.


  • void shape_owner_add_shape ( int owner_id, Shape shape )

Adds a Shape to the shape owner.


  • void shape_owner_clear_shapes ( int owner_id )

Removes all shapes from the shape owner.


  • Object shape_owner_get_owner ( int owner_id ) const

Returns the parent object of the given shape owner.


  • Shape shape_owner_get_shape ( int owner_id, int shape_id ) const

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


  • int shape_owner_get_shape_count ( int owner_id ) const

Returns the number of shapes the given shape owner contains.


  • int shape_owner_get_shape_index ( int owner_id, int shape_id ) const

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


  • Transform shape_owner_get_transform ( int owner_id ) const

Returns the shape owner’s Transform.


  • void shape_owner_remove_shape ( int owner_id, int shape_id )

Removes a shape from the given shape owner.


  • void shape_owner_set_disabled ( int owner_id, bool disabled )

If true, disables the given shape owner.


  • void shape_owner_set_transform ( int owner_id, Transform transform )

Sets the Transform of the given shape owner.