Inherits: Spatial<class_spatial>
< Node<class_node>
< Object<class_object>
Inherited By: PhysicsBody<class_physicsbody>
, Area<class_area>
Category: Core
Base node for collision objects.
void | _input_event<class_CollisionObject__input_event> ( Object<class_object> camera, InputEvent<class_inputevent> event, Vector3<class_vector3> click_position, Vector3<class_vector3> click_normal, int<class_int> shape_idx ) virtual |
int<class_int> |
create_shape_owner<class_CollisionObject_create_shape_owner> ( Object<class_object> owner ) |
RID<class_rid> |
get_rid<class_CollisionObject_get_rid> ( ) const |
Array<class_array> |
get_shape_owners<class_CollisionObject_get_shape_owners> ( ) |
bool<class_bool> |
is_shape_owner_disabled<class_CollisionObject_is_shape_owner_disabled> ( int<class_int> owner_id ) const |
void | remove_shape_owner<class_CollisionObject_remove_shape_owner> ( int<class_int> owner_id ) |
int<class_int> |
shape_find_owner<class_CollisionObject_shape_find_owner> ( int<class_int> shape_index ) const |
void | shape_owner_add_shape<class_CollisionObject_shape_owner_add_shape> ( int<class_int> owner_id, Shape<class_shape> shape ) |
void | shape_owner_clear_shapes<class_CollisionObject_shape_owner_clear_shapes> ( int<class_int> owner_id ) |
Object<class_object> |
shape_owner_get_owner<class_CollisionObject_shape_owner_get_owner> ( int<class_int> owner_id ) const |
Shape<class_shape> |
shape_owner_get_shape<class_CollisionObject_shape_owner_get_shape> ( int<class_int> owner_id, int<class_int> shape_id ) const |
int<class_int> |
shape_owner_get_shape_count<class_CollisionObject_shape_owner_get_shape_count> ( int<class_int> owner_id ) const |
int<class_int> |
shape_owner_get_shape_index<class_CollisionObject_shape_owner_get_shape_index> ( int<class_int> owner_id, int<class_int> shape_id ) const |
Transform<class_transform> |
shape_owner_get_transform<class_CollisionObject_shape_owner_get_transform> ( int<class_int> owner_id ) const |
void | shape_owner_remove_shape<class_CollisionObject_shape_owner_remove_shape> ( int<class_int> owner_id, int<class_int> shape_id ) |
void | shape_owner_set_disabled<class_CollisionObject_shape_owner_set_disabled> ( int<class_int> owner_id, bool<class_bool> disabled ) |
void | shape_owner_set_transform<class_CollisionObject_shape_owner_set_transform> ( int<class_int> owner_id, Transform<class_transform> transform ) |
- input_event (
Object<class_object>
camera,Object<class_object>
event,Vector3<class_vector3>
click_position,Vector3<class_vector3>
click_normal,int<class_int>
shape_idx )
Emitted when _input_event<class_CollisionObject__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.
bool<class_bool>
input_capture_on_drag - Iftrue
theCollisionObject
will continue to receive input events as the mouse is dragged across its shapes. Default value:false
.bool<class_bool>
input_ray_pickable - Iftrue
theCollisionObject<class_collisionobject>
's shapes will respond toRayCast<class_raycast>
s. Default value:true
.
CollisionObject is the base class for physics objects. It can hold any number of collision Shape<class_shape>
s. 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.
- void _input_event (
Object<class_object>
camera,InputEvent<class_inputevent>
event,Vector3<class_vector3>
click_position,Vector3<class_vector3>
click_normal,int<class_int>
shape_idx ) virtual
Accepts unhandled InputEvent<class_inputevent>
s. click_position
is the clicked location in world space and click_normal
is the normal vector extending from the clicked surface of the Shape<class_shape>
at shape_idx
. Connect to the input_event
signal to easily pick up these events.
int<class_int>
create_shape_owner (Object<class_object>
owner )
Creates a new shape owner for the given object. Returns owner_id
of the new owner for future reference.
RID<class_rid>
get_rid ( ) const
Returns the object's RID<class_rid>
.
Array<class_array>
get_shape_owners ( )
Returns an Array<class_array>
of owner_id
identifiers. You can use these ids in other methods that take owner_id
as an argument.
bool<class_bool>
is_shape_owner_disabled (int<class_int>
owner_id ) const
If true
the shape owner and its shapes are disabled.
- void remove_shape_owner (
int<class_int>
owner_id )
Removes the given shape owner.
int<class_int>
shape_find_owner (int<class_int>
shape_index ) const
Returns the owner_id
of the given shape.
- void shape_owner_add_shape (
int<class_int>
owner_id,Shape<class_shape>
shape )
Adds a Shape<class_shape>
to the shape owner.
- void shape_owner_clear_shapes (
int<class_int>
owner_id )
Removes all shapes from the shape owner.
Object<class_object>
shape_owner_get_owner (int<class_int>
owner_id ) const
Returns the parent object of the given shape owner.
Shape<class_shape>
shape_owner_get_shape (int<class_int>
owner_id,int<class_int>
shape_id ) const
Returns the Shape<class_shape>
with the given id from the given shape owner.
int<class_int>
shape_owner_get_shape_count (int<class_int>
owner_id ) const
Returns the number of shapes the given shape owner contains.
int<class_int>
shape_owner_get_shape_index (int<class_int>
owner_id,int<class_int>
shape_id ) const
Returns the child index of the Shape<class_shape>
with the given id from the given shape owner.
Transform<class_transform>
shape_owner_get_transform (int<class_int>
owner_id ) const
Returns the shape owner's Transform<class_transform>
.
- void shape_owner_remove_shape (
int<class_int>
owner_id,int<class_int>
shape_id )
Removes a shape from the given shape owner.
- void shape_owner_set_disabled (
int<class_int>
owner_id,bool<class_bool>
disabled )
If true
disables the given shape owner.
- void shape_owner_set_transform (
int<class_int>
owner_id,Transform<class_transform>
transform )
Sets the Transform<class_transform>
of the given shape owner.