class_collisionobject2d - dragonsoulz/godot GitHub Wiki
CollisionObject2D
####Inherits: Node2D ####Category: Core
Brief Description
Base node for 2D collisionables.
Member Functions
- void add_shape ( Shape2D shape, Matrix32 transform=1,0, 0,1, 0,0 )
- int get_shape_count ( ) const
- void set_shape ( int shape_idx, Shape shape )
- void set_shape_transform ( int shape_idx, Matrix32 transform )
- void set_shape_as_trigger ( int shape_idx, bool enable )
- Shape2D get_shape ( int shape_idx ) const
- Matrix32 get_shape_transform ( int shape_idx ) const
- bool is_shape_set_as_trigger ( int shape_idx ) const
- void remove_shape ( int shape_idx )
- void clear_shapes ( )
- RID get_rid ( ) const
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
Change a shape in the collision body.
set_shape_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.