Trail
*Bu içerik, yapay zekâ (beta) kullanılarak çevrildi ve hatalar içerebilir. Sayfayı İngilizce görüntülemek için buraya tıkla.
İz nesnesi, iki bağlantı arasında bir iz efekti oluşturmak için kullanılır.Eklentiler uzayda hareket ettiğinde, tanımlanan plana bir doku çizilir.Bu genellikle mermilerin, ayak izlerinin, lastik izlerinin ve benzeri hareketlerin görselleştirdiği efektleri oluşturmak için kullanılır.
Daha fazla bilgi için İzler bakın.
Kod Örnekleri
This example demos the functionality of Trails by creating a BasePart to be the parent of the trail. Two Attachments are then parented to the part. The positions of these two attachments (more importantly the distance between them) determines where the trail is drawn as the part moves.
For these attachments to create a trail as described, a new Trail is parented to the part and its Attachment0 and Attachment1 are parented to attachment0 and attachment1 respectively. Finally, TweenService is used to move the part back and forth, showing how the trail is drawn as the part (and its attachments) move.
local TweenService = game:GetService("TweenService")
-- Create a parent part
local part = Instance.new("Part")
part.Material = Enum.Material.SmoothPlastic
part.Size = Vector3.new(4, 1, 2)
part.Position = Vector3.new(0, 5, 0)
part.Anchored = true
part.Parent = workspace
-- Create attachments on part
local attachment0 = Instance.new("Attachment")
attachment0.Name = "Attachment0"
attachment0.Position = Vector3.new(-2, 0, 0)
attachment0.Parent = part
local attachment1 = Instance.new("Attachment")
attachment1.Name = "Attachment1"
attachment1.Position = Vector3.new(2, 0, 0)
attachment1.Parent = part
-- Create a new trail
local trail = Instance.new("Trail")
trail.Attachment0 = attachment0
trail.Attachment1 = attachment1
trail.Parent = part
-- Tween part to display trail
local dir = 15
while true do
dir *= -1
local goal = { Position = part.Position + Vector3.new(0, 0, dir) }
local tweenInfo = TweenInfo.new(3)
local tween = TweenService:Create(part, tweenInfo, goal)
tween:Play()
task.wait(4)
end
Özet
Özellikler
Attachment1 ile birlikte, izin parçalarını çizmeye başlayacağı yeri belirler.
Attachment0 ile birlikte, izin parçalarını çizmeye başlayacağı yeri belirler.
LightInfluence 1'den az olduğunda yoldan yayılan ışığı ölçeklendirir.
Hayatı boyunca izin rengi.
İz çizilecek mi yoksa çizilmeyecek mi belirler.
Yolun yönüne bakılmaksızın yolun daima kameraya bakıp bakmayacağını belirler.
Bir izdeki her bir segmentin kaç saniye süreceğini belirler, saniyeler içinde.
Yolun renklerinin arkasındaki renklerle ne ölçüde birleştirileceğini belirler.
İzin, çevrenin aydınlatması tarafından etkilendiği dereceyi belirler.
Yolun maksimum uzunluğunu ayarlar.
İzin minimum uzunluğunu ayarlar.
Yolda görüntülenecek dokunun içeriği ID'si.
Yolun dokusunun uzunluğunu ayarlar, TextureMode 'ye bağlı olarak.
Texture ölçeklerin, tekrarların ve yolun ekleriyle birlikte hareket etmesinin şeklini belirler.
Yolun bölümlerinin şeffaflığını Lifetime.
Hayatı boyunca izin genişliğini ölçeklendirir.
Yöntemler
Yolun segmentlerini temizler.
Özellikler
Attachment0
Attachment1
Brightness
Color
Kod Örnekleri
local TweenService = game:GetService("TweenService")
-- Create a parent part
local part = Instance.new("Part")
part.Material = Enum.Material.SmoothPlastic
part.Size = Vector3.new(4, 1, 2)
part.Position = Vector3.new(0, 5, 0)
part.Anchored = true
part.Parent = workspace
-- Create attachments on part
local attachment0 = Instance.new("Attachment")
attachment0.Name = "Attachment0"
attachment0.Position = Vector3.new(-2, 0, 0)
attachment0.Parent = part
local attachment1 = Instance.new("Attachment")
attachment1.Name = "Attachment1"
attachment1.Position = Vector3.new(2, 0, 0)
attachment1.Parent = part
-- Create a new trail with color gradient
local trail = Instance.new("Trail")
trail.Attachment0 = attachment0
trail.Attachment1 = attachment1
local color1 = Color3.fromRGB(255, 0, 0)
local color2 = Color3.fromRGB(0, 0, 255)
trail.Color = ColorSequence.new(color1, color2)
trail.Parent = part
-- Tween part to display trail
local dir = 15
while true do
dir *= -1
local goal = { Position = part.Position + Vector3.new(0, 0, dir) }
local tweenInfo = TweenInfo.new(3)
local tween = TweenService:Create(part, tweenInfo, goal)
tween:Play()
task.wait(4)
end
Enabled
FaceCamera
Lifetime
LightEmission
LightInfluence
LocalTransparencyModifier
MaxLength
MinLength
Texture
Kod Örnekleri
local TweenService = game:GetService("TweenService")
-- Create a parent part
local part = Instance.new("Part")
part.Material = Enum.Material.SmoothPlastic
part.Size = Vector3.new(2, 1, 2)
part.Position = Vector3.new(0, 5, 0)
part.Anchored = true
part.Parent = workspace
-- Create attachments on part
local attachment0 = Instance.new("Attachment")
attachment0.Name = "Attachment0"
attachment0.Position = Vector3.new(-1, 0, 0)
attachment0.Parent = part
local attachment1 = Instance.new("Attachment")
attachment1.Name = "Attachment1"
attachment1.Position = Vector3.new(1, 0, 0)
attachment1.Parent = part
-- Create a new trail with color gradient
local trail = Instance.new("Trail")
trail.Attachment0 = attachment0
trail.Attachment1 = attachment1
trail.Texture = "rbxassetid://16178262222"
trail.TextureMode = Enum.TextureMode.Static
trail.TextureLength = 2
trail.Parent = part
-- Tween part to display trail
local dir = 15
while true do
dir *= -1
local goal = { Position = part.Position + Vector3.new(0, 0, dir) }
local tweenInfo = TweenInfo.new(3)
local tween = TweenService:Create(part, tweenInfo, goal)
tween:Play()
task.wait(4)
end