Skip to content

Search

Documentation

occluder2d component

The outline the node blocks 2D light with. With no mesh it follows the node's collider2d, or else its circle, capsule, rect or sprite shape.

On this page

2d · render · 2 properties · 2D

The outline the node blocks 2D light with. With no mesh it follows the node's collider2d, or else its circle, capsule, rect or sprite shape.

In a scene, occluder2d is the node key that applies it. A script reaches each property below as a field on node.occluder2d: reading one asks the running component, and assigning one leaves the rest alone. The whole table is node.occluder2d.get() and node.occluder2d.set(table).

Properties

property type default description
closed bool true Whether the last point joins the first, making the outline a loop
mesh asset · mesh — Outline points in order, [x, y] in the node's space; empty derives the outline from the node's collider2d, then from its 2D shape

Asset types this component references: mesh.

Script functions

Methods of node.occluder2d, the handle a node carrying this component exposes. Every handle also has get(), set(table), patch(table), has() and remove().

From render:

method what it does
outline() -> [float] The outline this node blocks 2D light with, in world space: x then y for each point in turn, with the first repeated at the end when the outline is closed. Empty on a node with no occluder2d.