PointLight

显示已弃用

*此内容使用人工智能(Beta)翻译,可能包含错误。若要查看英文页面,请点按 此处

一个点光是发光源,它从单个点发出照明。根据点光的 PointLight.Range ,发光的球体是圆形的。

为了使 PointLight 提供照明,它必须是 BasePartAttachment 的直接子级 (部分或附件本身必须是 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.

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

读取并联

点光源将照亮的区域的大小。

方法

活动