CollisionObject

    Inherited By: Area,

    Base node for collision objects.

    CollisionObject is the base class for physics objects. It can hold any number of collision 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 methods.

    Properties

    void

    _input_event ( camera, InputEvent event, position, Vector3 normal, shape_idx ) virtual

    int

    ( Object owner )

    get_collision_layer_bit ( bit ) const

    bool

    ( int bit ) const

    get_rid ( ) const

    get_shape_owners ( )

    is_shape_owner_disabled ( owner_id ) const

    void

    remove_shape_owner ( owner_id )

    void

    set_collision_layer_bit ( bit, bool value )

    void

    ( int bit, value )

    int

    ( int shape_index ) const

    ( int owner_id, shape )

    void

    shape_owner_clear_shapes ( owner_id )

    Object

    ( int owner_id ) const

    shape_owner_get_shape ( owner_id, int shape_id ) const

    shape_owner_get_shape_count ( owner_id ) const

    int

    ( int owner_id, shape_id ) const

    Transform

    ( int owner_id ) const

    void

    ( int owner_id, shape_id )

    void

    shape_owner_set_disabled ( owner_id, bool disabled )

    void

    ( int owner_id, transform )

    Signals

    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.

    • int collision_layer

    The physics layers this CollisionObject3D is in. Collision objects can exist in one or more of 32 different layers. See also .

    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.


    Default

    1

    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 .


    • bool input_capture_on_drag

    If true, the will continue to receive input events as the mouse is dragged across its shapes.


    • input_ray_pickable

    Default

    true

    Setter

    set_ray_pickable(value)

    Getter

    is_ray_pickable()

    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 collision_layer bit to be set.

    Method Descriptions

    • void _input_event ( Object camera, event, Vector3 position, normal, int shape_idx ) virtual

    Receives unhandled s. 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.


    • create_shape_owner ( Object owner )

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


    • get_collision_layer_bit ( int bit ) const

    Returns whether or not the specified bit of the is set.


    • bool get_collision_mask_bit ( bit ) const

    Returns whether or not the specified bit of the collision_mask is set.


    • get_rid ( ) const

    Returns the object’s RID.


    • 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.


    • is_shape_owner_disabled ( int owner_id ) const

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


    • void remove_shape_owner ( owner_id )

    Removes the given shape owner.


    If is true, sets the specified bit in the the collision_layer.

    If value is false, clears the specified bit in the the .


    • void set_collision_mask_bit ( int bit, value )

    If value is true, sets the specified bit in the the collision_mask.

    If value is false, clears the specified bit in the the .


    • int shape_find_owner ( shape_index ) const

    Returns the of the given shape.


    • void shape_owner_add_shape ( int owner_id, shape )

    Adds a Shape to the shape owner.


    • void shape_owner_clear_shapes ( owner_id )

    Removes all shapes from the shape owner.


    • Object shape_owner_get_owner ( owner_id ) const

    Returns the parent object of the given shape owner.


    • Shape shape_owner_get_shape ( owner_id, int shape_id ) const

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


    • int shape_owner_get_shape_count ( owner_id ) const

    Returns the number of shapes the given shape owner contains.


    • int shape_owner_get_shape_index ( owner_id, int shape_id ) const

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


    • Transform shape_owner_get_transform ( owner_id ) const

    Returns the shape owner’s Transform.


    • void shape_owner_remove_shape ( owner_id, int shape_id )

    Removes a shape from the given shape owner.


    If true, disables the given shape owner.


    • void shape_owner_set_transform ( owner_id, Transform transform )

    Sets the of the given shape owner.