Topic was automatically imported from the old Question2Answer platform.
Asked By
equestor
Old Version
Published before Godot 3 was released.
Hi everyone
I am new to using Godot Engine but see it’s potential because of it’s structure and license. I have a rather basic question, how does one set the shape, or edge, and size of a RigidShape2D, be it a rectangle, circle, triangle and a more complex shape? Is there a tutorial on this?
Add a CollisionShape2D as child node of the RigidBody2D, then set its “Shape” property (circleshape/rectangleshape… etc.).
If you want a custom polygon, you can use CollisionPolygon2D (instead of CollisionShape2D). In this case you have to add the coordinates manually one by one (pencil icon on the toolbar).
Via scene editor, you can set the shape adding a CollisionShape2D or CollisionPolygon2D as a child of the body(one child per shape), then set the shape type, most types have visual ways to modify the shapes.
These nodes are editor helpers, not the actual shapes (which are resources, not nodes).
Via code, use set_shape or add_shape with the Shape resource you want.