Skip to content

class_collisionobject2d

Lukas Sägesser edited this page Jun 22, 2015 · 10 revisions

CollisionObject2D

####Inherits: Node2D ####Category: Core

Brief Description

Base node for 2D collisionables.

Member Functions

Signals

  • mouse_enter ( )
  • input_event ( Object viewport, InputEvent event, int shape_idx )
  • mouse_exit ( )

Description

CollisionObject2D is the base class for 2D physics collisionables. They can hold any number of 2D collision shapes. Usually, they are edited by placing CollisionBody2D and CollisionPolygon2D nodes as children. Such nodes are for reference ant not present outside the editor, so code should use the regular shape API.

Member Function Description

Add a Shape2D to the collision body, with a given custom transform.

  • int get_shape_count ( ) const

Return the amount of shapes in the collision body.

  • void set_shape ( int shape_idx, Shape shape )

Change a shape in the collision body.

  • void set_shape_transform ( int shape_idx, Matrix32 transform )

Change the shape transform in the collision body.

Return the shape in the given index.

Return the shape transform in the given index.

  • void remove_shape ( int shape_idx )

Remove the shape in the given index.

  • void clear_shapes ( )

Remove all shapes.

Clone this wiki locally