CollisionObject
Inherits: Spatial < Node < Object
Inherited By: Area, PhysicsBody
Base node for collision objects.
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.
Properties
| ||
| ||
| ||
|
Methods
Signals
- input_event ( Node camera, InputEvent event, Vector3 position, Vector3 normal, int shape_idx )
Emitted when the object receives an unhandled InputEvent. position
is the location in world space of the mouse pointer on the surface of the shape with index shape_idx
and normal
is the normal vector of the surface at that point.
- 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.
Property Descriptions
- int collision_layer
Default |
|
Setter | set_collision_layer(value) |
Getter | get_collision_layer() |
The physics layers this CollisionObject3D is in. Collision objects can exist in one or more of 32 different layers. See also collision_mask.
Note: A contact is detected if object A is in any of the layers that object B scans, or object B is in any layers that object A scans. See Collision layers and masks in the documentation for more information.
- int collision_mask
Default |
|
Setter | set_collision_mask(value) |
Getter | get_collision_mask() |
The physics layers this CollisionObject3D scans. Collision objects can scan one or more of 32 different layers. See also collision_layer.
Note: A contact is detected if object A is in any of the layers that object B scans, or object B is in any layers that object A scans. See Collision layers and masks in the documentation for more information.
- bool input_capture_on_drag
Default |
|
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.
- bool input_ray_pickable
Default |
|
Setter | set_ray_pickable(value) |
Getter | is_ray_pickable() |
If true
, the CollisionObject
‘s shapes will respond to RayCasts.
Method Descriptions
- void _input_event ( Object camera, InputEvent event, Vector3 position, Vector3 normal, int shape_idx ) virtual
Receives unhandled InputEvents. position
is the location in world space of the mouse pointer on the surface of the shape with index shape_idx
and normal
is the normal vector of the surface at that point. 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.
Returns whether or not the specified bit
of the collision_layer is set.
Returns whether or not the specified bit
of the collision_mask is set.
- 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.
If true
, the shape owner and its shapes are disabled.
- void remove_shape_owner ( int owner_id )
Removes the given shape owner.
If value
is true
, sets the specified bit
in the the collision_layer.
If value
is false
, clears the specified bit
in the the collision_layer.
If value
is true
, sets the specified bit
in the the collision_mask.
If value
is false
, clears the specified bit
in the the collision_mask.
Returns the owner_id
of the given shape.
Adds a Shape to the shape owner.
- void shape_owner_clear_shapes ( int owner_id )
Removes all shapes from the shape owner.
Returns the parent object of the given shape owner.
Returns the Shape with the given id from the given shape owner.
Returns the number of shapes the given shape owner contains.
Returns the child index of the Shape with the given id from the given shape owner.
Returns the shape owner’s Transform.
Removes a shape from the given shape owner.
If true
, disables the given shape owner.
Sets the Transform of the given shape owner.