Work in progress

Godot documentation is being updated to reflect the latest changes in version 4.0. Some documentation pages may still state outdated information. This banner will tell you if you're reading one of such pages.

The contents of this page are up to date. If you can still find outdated information, please open an issue.

CapsuleShape2D

Inherits: Shape2D < Resource < RefCounted < Object

Capsule shape resource for 2D physics.

Description

2D capsule shape to be added as a direct child of a PhysicsBody2D or Area2D using a CollisionShape2D node. In 2D, a capsule is a rectangle shape with half-circles at both ends.

Performance: Being a primitive collision shape, CapsuleShape2D is fast to check collisions against (though not as fast as CircleShape2D).

Properties

float

height

30.0

float

radius

10.0


Property Descriptions

float height = 30.0

  • void set_height ( float value )

  • float get_height ( )

The capsule's height.


float radius = 10.0

  • void set_radius ( float value )

  • float get_radius ( )

The capsule's radius.