Attention: Here be dragons

This is the latest (unstable) version of this documentation, which may document features not available in or compatible with released stable versions of Godot.

RectangleShape2D

Inherits: Shape2D < Resource < RefCounted < Object

Rectangle shape resource for 2D physics.

Description

2D rectangle shape to be added as a direct child of a PhysicsBody2D or Area2D using a CollisionShape2D node. This shape is useful for modeling box-like 2D objects.

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

Tutorials

Properties

Vector2

size

Vector2(20, 20)


Property Descriptions

Vector2 size = Vector2(20, 20)

The rectangle's width and height.