一个表面灯是一种发出特定 Light.Color 和 Light.Brightness 照明的灯光来源,从一个 SurfaceLight.Face 发出为特定 SurfaceLight.Range 的照明。
为了使 SurfaceLight 提供照明,它必须是 BasePart 或 Attachment (部分或附件本身必须是工作区的后裔)的直接子女。如果表面灯被父辈到零件,那么光将从零件的选定面发出。如果与附件表面灯相关,那么相当于一个 SpotLight 。
对于更多的灯光类型,请参阅 也看 部分。
还看到也看到
代码示例
This example creates a new anchored BasePart named Part at the position {0, 0, 0}.
It then creates a new surface light with brightness of 1, Color3 color of {255/255, 255/255, 255/255} (white) and range of 16 studs. The surface light's parent is set to the BasePart we created. To view the light, navigate to the part at {0, 0, 0} or move the Part created to a location visible to the player.
Please note that the properties of the created surface light can easily be changed by modifying the property values in the code sample below. Additionally, if you have an existing surface light, you can also create a similar script that modifies that surface light instead of creating a new BasePart and light.
local part = Instance.new("Part")
part.Anchored = true
part.Position = Vector3.new(0, 0, 0)
part.Parent = workspace
local light = Instance.new("SurfaceLight")
light.Color = Color3.fromRGB(255, 255, 255)
light.Brightness = 1
light.Range = 16
light.Parent = part
概要
属性
从表面灯发出的光角。
设置 SurfaceLight 来自父辈的一侧。
距离表面灯的脸亮起的距离。
设置发出的光的亮度,默认为 1。
发射的光的颜色。
如果设置为真,光将从源对象发出。
如果设置为真,将投射阴影,如果光被障碍物阻挡。