Up to date

This page is up to date for Godot 4.2. If you still find outdated information, please open an issue.

PointLight2D

继承: Light2D < Node2D < CanvasItem < Node < Object

位置性 2D 光源。

描述

在 2D 环境中投射光线。此灯的形状由(通常为灰度)纹理定义。

教程

属性

float

height

0.0

Vector2

offset

Vector2(0, 0)

Texture2D

texture

float

texture_scale

1.0


属性说明

float height = 0.0

  • void set_height ( float value )

  • float get_height ( )

灯光的高度。与 2D 法线贴图一起使用。单位为像素,例如:如果高度为 100,那么它能够照亮 100 像素远且与该平面成 45° 角的对象。


Vector2 offset = Vector2(0, 0)

  • void set_texture_offset ( Vector2 value )

  • Vector2 get_texture_offset ( )

灯光的 texture 的偏移量。


Texture2D texture

用于该灯光外观的 Texture2D


float texture_scale = 1.0

  • void set_texture_scale ( float value )

  • float get_texture_scale ( )

texture 的缩放系数。