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, bool value )

void

set_collision_mask_value ( int layer_number, bool value )

int

shape_find_owner ( int shape_index ) const

void

shape_owner_add_shape ( int owner_id, Shape2D shape )

void

shape_owner_clear_shapes ( int owner_id )

Object

shape_owner_get_owner ( int owner_id ) const

Shape2D

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

Transform2D