CollisionShape2D

Inherits: Node2D < CanvasItem < Node < Object

Category: Core

Brief Description

Editor-only class for easy editing of shapes.

Member Functions

int get_collision_object_shape_index ( ) const
Object get_shape ( ) const
bool is_trigger ( ) const
void set_shape ( Object shape )
void set_trigger ( bool enable )

Description

Editor-only class. This is not present when running the game. It’s used in the editor to properly edit and position collision shapes in CollisionObject2D. This is not accessible from regular code.

Member Function Description

  • int get_collision_object_shape_index ( ) const

Return the index of this shape inside its container CollisionObject2D. This can be used to directly access the underlying Shape2D.

Return this shape’s Shape2D.

  • bool is_trigger ( ) const

Return whether this shape is a trigger.

  • void set_shape ( Object shape )

Set this shape’s Shape2D. This will not appear as a node, but can be directly edited as a property.

  • void set_trigger ( bool enable )

Set whether this shape is a trigger. A trigger shape detects collisions, but is otherwise unaffected by physics (i.e. will not block movement of colliding objects).