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.

WorldBoundaryShape2D

Inherits: Shape2D < Resource < RefCounted < Object

World boundary (infinite plane) shape resource for 2D physics.

Description

2D world boundary shape to be added as a direct child of a PhysicsBody2D or Area2D using a CollisionShape2D node. WorldBoundaryShape2D works like an infinite plane and will not allow any physics body to go to the negative side. Note that the normal matters; anything "below" the plane will collide with it. If the WorldBoundaryShape2D is used in a PhysicsBody2D, it will cause colliding objects placed "below" it to teleport "above" the plane.

Performance: Being a primitive collision shape, WorldBoundaryShape2D is fast to check collisions against.

Properties

float

distance

0.0

Vector2

normal

Vector2(0, -1)


Property Descriptions

float distance = 0.0

  • void set_distance ( float value )

  • float get_distance ( )

The line's distance from the origin.


Vector2 normal = Vector2(0, -1)

The line's normal. Defaults to Vector2.UP.