一個表面燈是一種發射特定 Light.Color 和 Light.Brightness 從一個 SurfaceLight.Face 對特定 SurfaceLight.Range 照明的光源。
為了提供照明,SurfaceLight必須是BasePart或Attachment(部分或附件本身必須是工作區的後裔)的直接子女。如果表面燈與零件相關聯,燈光將從零件的選定面(s)發出。如果與附件表面燈相關聯,它與 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。
發射的光的顏色。
如果設為真值,光將從來源對物件發出。
如果設為真,在光被障礙物阻擋時會投射陰影。