PointLight

顯示已棄用項目

*此內容是使用 AI(Beta 測試版)翻譯,可能含有錯誤。若要以英文檢視此頁面,請按一下這裡

點光是一種發射單點照明的光源。光是根據點光的 PointLight.Range 來球面發射的。

為了使點光提供照明,它必須是 BasePartAttachment (部分或附件本身必須是 Workspace 的後裔) 的直接兒女。

如果點光屬於零件,那麼光將從零件的 BasePart.Position 發出。如果點光被附加到附件,那麼光線將從附件的 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.

Creating a New Point 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

概要

屬性

  • 平行讀取

    點光源將照亮的區域大小。

屬性 繼承自 Light
  • 平行讀取

    設置發射的光有多亮,默認值為 1。

  • 平行讀取

    發射的光的顏色。

  • 平行讀取

    如果設為真值,光將從來源對物件發出。

  • 平行讀取

    如果設為真,在光被障礙物阻擋時會投射陰影。

屬性

Range

平行讀取

點光源將照亮的區域大小。

方法

活動