Skip to content

SimpleAreaShadowLight ​

SimpleAreaShadowLight 是暗调矩形自发光体,用较深颜色呈现面状装饰光效,不会向周围物体投射真实照明。

概览 ​

SimpleAreaShadowLight 是暗调矩形自发光体,用较深颜色呈现面状装饰光效,不会向周围物体投射真实照明。

适用场景 ​

用于夜景面板、洞穴标记或暗色界面装饰等低亮度矩形自发光外观。

使用要点 ​

通过 World:CreateUnit("SimpleAreaShadowLight", config) 创建实例,用 Color 和 Size 调整暗调自发光面的颜色与尺寸。

注意事项 ​

SimpleAreaShadowLight 创建后需要绑定到引擎支持的光照挂载结构并处于可渲染场景中才可能生效;单独 World:CreateUnit 或简单挂到 LightingService/WorldUnit 不一定产生视觉表现。当前表现依赖渲染管线版本,请在目标端实测。

继承自 SimpleLight;可通过 World:CreateUnit("SimpleAreaShadowLight", ...) 创建;返回单个单位

代码示例 ​

创建暗调面光源并设置尺寸

lua
-- @runtime server
local world = game:GetService("World")

local light = world:CreateUnit("SimpleAreaShadowLight", {
    Position = Vector3.New(0, 3, 10),
    Color = Color3.New(0, 255, 102),
    Size = Vector2.New(4, 3),
})
print("SimpleAreaShadowLight:", light)

属性 ​

名称类型默认值说明
ColorColor316777215阴影源颜色。
SizeVector2[1.0, 1.0]阴影源面的尺寸。
TransparencyFloat0.6光源模型的透明度,值越小越透明(阴影越暗)。取值范围 [0.0, 1.0]。