CircleShape2D
Circular 2D collision geometry with an adjustable radius.
CircleShape2D defines a circle centered at the local origin. Radius is a radius, not a diameter; it starts at 10. GetRect() returns local bounds from (-Radius,-Radius), sized (2×Radius,2×Radius). World position is not included in these bounds.
For a collider, assign the resource to Shape on a CollisionShape2D inside the required CollisionObject2D. Creating the resource alone adds no body to the world. Editing a shared resource affects all its users; create a separate instance for independent dimensions.
Radius and SetRadius change the same value. A new value updates the physics shape and emits Changed; repeating a value emits no signal. Use a positive finite radius. Negative values are rejected, but the Inspector does not replace application input validation.
Dimensions, local bounds, Changed and direct overlap with a rectangle at supplied Transform2D values were checked in the installed engine. Body movement, contact resolution and collider appearance were not tested.
Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.
Constructors1
CircleShape2DConstructor
public CircleShape2D();Creates a circle with Radius=10 and local bounds Rect2(-10,-10,20,20). A geometry resource, not an independent physics body.
Properties1
RadiusProperty
public float Radius { get; set; }Circle radius in local 2D units, initially 10. Negative values are rejected; use a positive finite value for a working shape. A change updates the physics shape and emits Changed; assigning the same value does nothing.
Methods2
GetRadiusfloat
public float GetRadius();Current radius in local 2D units. Reading does not modify the shape.
floatCurrent radius in local 2D units. Reading does not modify the shape.
SetRadiusvoid
public void SetRadius(float radius);Circle radius in local 2D units, initially 10. Negative values are rejected; use a positive finite value for a working shape. A change updates the physics shape and emits Changed; assigning the same value does nothing.
| Name | Type | Default |
|---|---|---|
radius | float | — |
radiusNew positive finite circle radius in local 2D units.