-
Notifications
You must be signed in to change notification settings - Fork 1
π§© LightMesh2D
The LightMesh2D component defines a 2D light mesh that can be attached to a GameObject. It allows representing light areas using different shapes (rectangle, circle, or polygon), controlling their offset relative to the object, and managing the mesh configuration.
It is useful for 2D lighting systems, light masks, visual collision outlines, or any effect that requires a customizable light shape.
The LightMesh2D automatically updates its shapeβs position based on the GameObject's transform combined with the configured offset. This ensures that the light mesh moves consistently with the object while allowing independent adjustments. Changing the shape or offset immediately affects how the light is applied.
LightMesh2D(ShapePtr shape)Creates a new LightMesh2D with the provided shape. The shape can be a rectangle, circle, or polygon.
Shape GetShape()Returns the current shape associated with the LightMesh2D.
void SetShape(ShapePtr shape)Assigns a new shape to the LightMesh2D. If the shape is null, no changes are applied.
void SetOffset(Vector2 offset)
void SetOffset(float x, float y)Sets a relative offset for the light's position with respect to the GameObject it is attached to.
Vector2 GetOffset()Returns the current offset of the light relative to the GameObject.