煙霧是一些�
當 Smoke.Enabled 關閉時
煙霧粒子只會從 BasePart 中心發射,並且與它們所屬的 Attachment 中心相關。將一個煙霧對象親綁到 Class.Arrow 中,而不是親綁到 1> Class.BasePart1> 中,可以讓粒子的開始位置自訂。
範例程式碼
local function recurseForFire(object)
-- Check if we found a Fire object that has no Smoke
if object:IsA("Fire") and not object.Parent:FindFirstChildOfClass("Smoke") then
-- Create a smoke effect for this fire
local smoke = Instance.new("Smoke")
smoke.Color = Color3.new(0, 0, 0)
smoke.Opacity = 0.15
smoke.RiseVelocity = 4
smoke.Size = object.Size / 4
smoke.Parent = object.Parent
end
-- Continue search for Fire objects
for _, child in pairs(object:GetChildren()) do
recurseForFire(child)
end
end
recurseForFire(workspace)
概要
屬性
決定煙霧粒的顏色。
決定是否發射煙霧粒子。
決定煙霧粒子成像的不透明度。
決定煙霧粒子的速度。
決定煙霧新增物的大小。
值 0-1,控制粒子效果的速度。
屬性
Color
顏色屬性決定所有粒子發射的顏色,包括現有和未來的粒子。它與 Smoke 的行為相同,除了它是一個顏色和不是 Datatype.ColorSequ
範例程式碼
local function recurseForFire(object)
-- Check if we found a Fire object that has no Smoke
if object:IsA("Fire") and not object.Parent:FindFirstChildOfClass("Smoke") then
-- Create a smoke effect for this fire
local smoke = Instance.new("Smoke")
smoke.Color = Color3.new(0, 0, 0)
smoke.Opacity = 0.15
smoke.RiseVelocity = 4
smoke.Size = object.Size / 4
smoke.Parent = object.Parent
end
-- Continue search for Fire objects
for _, child in pairs(object:GetChildren()) do
recurseForFire(child)
end
end
recurseForFire(workspace)
Enabled
啟用屬性,與 ParticleEmitter.Enabled 非常相似,決定是否會發出煙霧粒子。任何粒子已發出的粒子都會繼續渲染直到它們的生命時間結束。這個屬性有助於在需要時
local Debris = game:GetService("Debris")
local part = script.Parent
function stopSmoke(smoke)
smoke.Enabled = false -- No more new particles
Debris:AddItem(smoke, 10) -- Remove the object after a delay (after existing particles have expired)
end
stopSmoke(part.Smoke)
範例程式碼
local function recurseForFire(object)
-- Check if we found a Fire object that has no Smoke
if object:IsA("Fire") and not object.Parent:FindFirstChildOfClass("Smoke") then
-- Create a smoke effect for this fire
local smoke = Instance.new("Smoke")
smoke.Color = Color3.new(0, 0, 0)
smoke.Opacity = 0.15
smoke.RiseVelocity = 4
smoke.Size = object.Size / 4
smoke.Parent = object.Parent
end
-- Continue search for Fire objects
for _, child in pairs(object:GetChildren()) do
recurseForFire(child)
end
end
recurseForFire(workspace)
LocalTransparencyModifier
Opacity
Opacity 決定煙霧粒子的不透明度。它必須在範圍內 [0, 1] 。這個屬性在比較中作 反向 ,與零件的 BasePart.Transparency 或 粒子發射器的 ParticleEmitter.Transparency 值:值為 0 是完全隱藏的,值為
Roblox 使用的材質對於 Smoke 粒子有一部分是透明的,所以將此屬性設置為 1 仍然會在渲染中產生透明煙霧。
範例程式碼
local function recurseForFire(object)
-- Check if we found a Fire object that has no Smoke
if object:IsA("Fire") and not object.Parent:FindFirstChildOfClass("Smoke") then
-- Create a smoke effect for this fire
local smoke = Instance.new("Smoke")
smoke.Color = Color3.new(0, 0, 0)
smoke.Opacity = 0.15
smoke.RiseVelocity = 4
smoke.Size = object.Size / 4
smoke.Parent = object.Parent
end
-- Continue search for Fire objects
for _, child in pairs(object:GetChildren()) do
recurseForFire(child)
end
end
recurseForFire(workspace)
RiseVelocity
RiseVelocity 與 ParticleEmitter.Speed 和 Fire.Heat 相同:它決定煙霧粒子在其生命時間內移動的速度。它必須在範圍 [-25, 25] 內發射。負值會導致粒子在父親 BasePart 的底部發射。
使用 Smoke 效果生成霧時,將此屬性設置為 0 。對於大型煙霧效果,請使煙勢溫和 (2 至 8)。對於煙囪和煙囪暫時,更高值是合適的。
範例程式碼
local function recurseForFire(object)
-- Check if we found a Fire object that has no Smoke
if object:IsA("Fire") and not object.Parent:FindFirstChildOfClass("Smoke") then
-- Create a smoke effect for this fire
local smoke = Instance.new("Smoke")
smoke.Color = Color3.new(0, 0, 0)
smoke.Opacity = 0.15
smoke.RiseVelocity = 4
smoke.Size = object.Size / 4
smoke.Parent = object.Parent
end
-- Continue search for Fire objects
for _, child in pairs(object:GetChildren()) do
recurseForFire(child)
end
end
recurseForFire(workspace)
Size
Class.Smoke 的大小將決定新發射的煙霧粒子的大小。與 Smoke.Color 不同,這個屬
範例程式碼
local function recurseForFire(object)
-- Check if we found a Fire object that has no Smoke
if object:IsA("Fire") and not object.Parent:FindFirstChildOfClass("Smoke") then
-- Create a smoke effect for this fire
local smoke = Instance.new("Smoke")
smoke.Color = Color3.new(0, 0, 0)
smoke.Opacity = 0.15
smoke.RiseVelocity = 4
smoke.Size = object.Size / 4
smoke.Parent = object.Parent
end
-- Continue search for Fire objects
for _, child in pairs(object:GetChildren()) do
recurseForFire(child)
end
end
recurseForFire(workspace)