Attention: Here be dragons

This is the latest (unstable) version of this documentation, which may document features not available in or compatible with released stable versions of Godot.

CollisionObject2D

Inherits: Node2D < CanvasItem < Node < Object

Inherited By: Area2D, PhysicsBody2D

Abstract base class for 2D physics objects.

Description

Abstract base class for 2D physics objects. CollisionObject2D can hold any number of Shape2Ds for collision. Each shape must be assigned to a shape owner. Shape owners are not nodes and do not appear in the editor, but are accessible through code using the shape_owner_* methods.

Note: Only collisions between objects within the same canvas (Viewport canvas or CanvasLayer) are supported. The behavior of collisions between objects in different canvases is undefined.

Properties

int

collision_layer

1

int

collision_mask

1

float

collision_priority

1.0

DisableMode

disable_mode

0

bool

input_pickable

true

Methods

void

_input_event ( Viewport viewport, InputEvent event, int shape_idx ) virtual

void

_mouse_enter ( ) virtual

void

_mouse_exit ( ) virtual

void

_mouse_shape_enter ( int shape_idx ) virtual

void

_mouse_shape_exit ( int shape_idx ) virtual

int

create_shape_owner ( Object owner )

bool

get_collision_layer_value ( int layer_number ) const

bool

get_collision_mask_value ( int layer_number ) const

RID

get_rid ( ) const

float

get_shape_owner_one_way_collision_margin ( int owner_id ) const

PackedInt32Array

get_shape_owners ( )

bool

is_shape_owner_disabled ( int owner_id ) const

bool

is_shape_owner_one_way_collision_enabled ( int owner_id ) const

void

remove_shape_owner ( int owner_id )

void

set_collision_layer_value ( int layer_number,