class_collisionobject2d - dragonsoulz/godot GitHub Wiki

CollisionObject2D

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

Brief Description

Base node for 2D collisionables.

Member Functions

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_shape

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

get_shape_count

  • int get_shape_count ( ) const

Return the amount of shapes in the collision body.

set_shape

  • void set_shape ( int shape_idx, Shape shape )

Change a shape in the collision body.

set_shape_transform

  • void set_shape_transform ( int shape_idx, Matrix32 transform )

Change the shape transform in the collision body.

get_shape

Return the shape in the given index.

get_shape_transform

Return the shape transform in the given index.

remove_shape

  • void remove_shape ( int shape_idx )

Remove the shape in the given index.

clear_shapes

  • void clear_shapes ( )

Remove all shapes.