Smoke

顯示已棄用項目

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

煙霧是一些�

Smoke.Enabled 關閉時

煙霧粒子只會從 BasePart 中心發射,並且與它們所屬的 Attachment 中心相關。將一個煙霧對象親綁到 Class.Arrow 中,而不是親綁到 1> Class.BasePart1> 中,可以讓粒子的開始位置自訂。

範例程式碼

Add Smoke to All Fire

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)

概要

屬性

屬性

Color

平行讀取

顏色屬性決定所有粒子發射的顏色,包括現有和未來的粒子。它與 Smoke 的行為相同,除了它是一個顏色和不是 Datatype.ColorSequ

範例程式碼

Add Smoke to All Fire

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)

範例程式碼

Add Smoke to All Fire

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 仍然會在渲染中產生透明煙霧。

範例程式碼

Add Smoke to All Fire

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.SpeedFire.Heat 相同:它決定煙霧粒子在其生命時間內移動的速度。它必須在範圍 [-25, 25] 內發射。負值會導致粒子在父親 BasePart 的底部發射。

使用 Smoke 效果生成霧時,將此屬性設置為 0 。對於大型煙霧效果,請使煙勢溫和 (2 至 8)。對於煙囪和煙囪暫時,更高值是合適的。

範例程式碼

Add Smoke to All Fire

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 不同,這個屬

範例程式碼

Add Smoke to All Fire

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)

TimeScale

平行讀取

值 0-1 會控制粒子效果的速度。在 1 運行正常速度,在 0.5 運行半速度,並在 0 凍結時間。

方法

活動