Trail

แสดงที่เลิกใช้งานแล้ว

*เนื้อหานี้แปลโดยใช้ AI (เวอร์ชัน Beta) และอาจมีข้อผิดพลาด หากต้องการดูหน้านี้เป็นภาษาอังกฤษ ให้คลิกที่นี่

วัตถุ เส้นทาง ใช้เพื่อสร้างเอฟเฟกต์เส้นทางระหว่างสองแนบเมื่อสิ่งที่แนบมาเคลื่อนที่ผ่านอวกาศแล้ว เทกเจอร์จะถูกวาดบนแผนการที่กำหนดไว้สิ่งนี้มักใช้เพื่อสร้างเอฟเฟกต์ที่แสดงการเคลื่อนไหวเช่นเส้นทางติดตามเบื้องหลังกระสุนปืน รอยเท้า เส้นทางยาง และเอฟเฟกต์ที่คล้ายกัน

ดู เส้นทาง สำหรับข้อมูลเพิ่มเติม

ตัวอย่างโค้ด

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.

Creating a Part with a Basic Trail

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

สรุป

คุณสมบัติ

  • อ่านพร้อมๆ กัน

    ร่วมกับ Attachment1 กำหนดว่าเส้นทางจะเริ่มวาดส่วนต่างๆ ที่ไหน

  • อ่านพร้อมๆ กัน

    ร่วมกับ Attachment0 กำหนดว่าเส้นทางจะเริ่มวาดส่วนต่างๆ ที่ไหน

  • อ่านพร้อมๆ กัน

    ขยายแสงที่ปล่อยจากเส้นทางเมื่อ LightInfluence น้อยกว่า 1

  • อ่านพร้อมๆ กัน

    สีของเส้นทางตลอดชีวิตของมัน

  • อ่านพร้อมๆ กัน

    กำหนดว่าเส้นทางจะถูกวาดหรือไม่

  • อ่านพร้อมๆ กัน

    กำหนดว่าเส้นทางจะเผชิญกับกล้องเสมอไม่ว่าจะเป็นทิศทางใดก็ตาม

  • อ่านพร้อมๆ กัน

    กำหนดระยะเวลาของแต่ละส่วนในเส้นทางที่จะใช้เวลานานแค่ไหนในวินาที

  • อ่านพร้อมๆ กัน

    กำหนดว่าสีของเส้นทางจะผสมกับสีที่อยู่เบื้องหลังมันในระดับใด

  • อ่านพร้อมๆ กัน

    กำหนดระดับที่เส้นทางได้รับอิทธิพลจากแสงของสภาพแวดล้อม

  • ซ่อนอยู่
    ไม่ซ้ำ
    อ่านพร้อมๆ กัน
  • อ่านพร้อมๆ กัน

    ตั้งค่าความยาวสูงสุดของเส้นทาง

  • อ่านพร้อมๆ กัน

    ตั้งค่าระยะขั้นต่ำของเส้นทาง

  • Texture:ContentId
    อ่านพร้อมๆ กัน

    ID เนื้อหาของเทกเจอร์ที่จะแสดงบนเส้นทาง

  • อ่านพร้อมๆ กัน

    ตั้งค่าความยาวของเทกเจอร์ของเส้นทางขึ้นอยู่กับ TextureMode

  • อ่านพร้อมๆ กัน

    กำหนดวิธีที่เครื่องชั่ง Texture ทำซ้ำและเคลื่อนที่ไปพร้อมกับสิ่งที่แนบมาของเส้นทาง

  • อ่านพร้อมๆ กัน

    ตั้งค่าความโปร่งใสของส่วนของเส้นทางผ่าน Lifetime ของมัน

  • อ่านพร้อมๆ กัน

    ขยายความกว้างของเส้นทางในระหว่างช่วงชีวิตของมัน

คุณสมบัติ

Attachment0

อ่านพร้อมๆ กัน

Attachment1

อ่านพร้อมๆ กัน

Brightness

อ่านพร้อมๆ กัน
อ่านพร้อมๆ กัน

ตัวอย่างโค้ด

สร้างเส้นทางด้วยการเปลี่ยนสีเฉดสี

local TweenService = game:GetService("TweenService")
-- สร้างส่วนราก
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
-- สร้างสิ่งที่แนบมาบนส่วน
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
-- สร้างเส้นทางใหม่ด้วยการเปลี่ยนสีไดนามิก
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
-- ส่วนกลางระหว่างแสดงเส้นทางการแสดงผล
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

ContentId
อ่านพร้อมๆ กัน

ตัวอย่างโค้ด

Creating a Trail with a Paw Print Texture

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

TextureLength

อ่านพร้อมๆ กัน

TextureMode

อ่านพร้อมๆ กัน

Transparency

อ่านพร้อมๆ กัน

WidthScale

อ่านพร้อมๆ กัน

วิธีการ

Clear

()

ส่งค่ากลับ

()

เหตุการณ์