PointLight 是一種發光源,發出從單個點發光的光束。光束由 PointLight.Range 決定。
為了提供點光照明,點光必須是 BasePart 或 Attachment 的直接子孫 (零件或附件自己必須是 Class.Workspace )。
如果 PointLight 與零件相關,則燈光會從零件的 BasePart.Position 發出。如果 PointLight 與附件相關,則燈光會從附件的 Attachment.WorldPosition 發出。
有關更多的光類型,請參閱 也看見 區。
也看看
範例程式碼
This example creates a new anchored BasePart named Part at the position {0, 0, 0}.
It then creates a new point light with brightness of 1, Color3 color of {255/255, 255/255, 255/255} (white) and range of 16 studs. The point 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 point light can easily be changed by modifying the property values in the code sample below. Additionally, if you have an existing point light, you can also create a similar script that modifies that 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("PointLight")
light.Color = Color3.new(1, 1, 1)
light.Brightness = 1
light.Range = 16
light.Parent = part
概要
屬性
點光所照亮的區域的尺寸。
設定發射的光是否有足夠的亮度,預設為 1。
發射的光的顏色。
設定為 "真" 時,光線將從來源對物件發射。
設定為 "真" 時,若光被障礙物阻擋,就會投影影子。