Trails with FaceCamera enabled stop rendering properly when moved extremely far away

Reproduction Steps
System Information
CPU Intel(R) Core™ i7-9700K CPU @ 3.60GHz
GPU NVIDIA GeForce GTX 1050 Ti
Memory: 16.0GB

Reproduction File
reproPlace.rbxl (28.1 KB)

Open this place, go into Run mode, and while observing the central cube with the Trail inside of it, run this code in the command bar:

local Base = workspace.Part
Base.CFrame = CFrame.new(math.huge, 0, 0)
task.wait() -- Wait for the next Heartbeat frame. This doesn't happen if it's immediate.
Base.CFrame = CFrame.new(0, 0, 0)

local r = 0
while true do
    task.wait()
    r += 5
    Base.CFrame = CFrame.Angles(0, math.rad(r), 0) * CFrame.new(0, 6, 6)
end

Once it starts spinning, that means it has already came back from the distance, and is when the Trail should start rendering new segments.
SHAREX_1646274921

Expected Behavior
I expect the Trail to immediately resume, or at the very least don’t render the path from ~inf to origin, and immediately resume new segments of the Trail’s path.

Actual Behavior
Once the trail comes back, it seems to assume that it’s still out of the ‘rendering space’ for the remainder of the Trail’s lifetime. For example, if the Trail’s lifetime is set to 10 seconds and you CFrame it back, it’ll wait 10 seconds before being visible. It seems to appear back with segments that would’ve existed initially.

I observed this issue while working with PartCache, where it reuses parts by caching them & CFraming them extremely far away from origin, where they can’t be rendered. This is because parenting can be slow, and CFrame is pretty fast to change. It took me over an hour until I figured out this was an issue with Roblox and not my trails, since it was taking about half of a second for my trails to appear, which was approximately the lifetime of the Trail.

Workaround
Make sure that if you do CFrame it far away, to disable any Trails under it before the first render frame where it’s far away, then enable them before the next render frame where it’s near the observable part of the world. That, or disable FaceCamera if that isn’t important to you.

For example, if you run this code instead of the one near the top, which follows the rule directly above, the problem isn’t present. This is my only known workaround.

EDIT: Call Trail:Clear() after moving to and from far away.

local Base = workspace.Part
Base.CFrame = CFrame.new(math.huge, 0, 0)
Base.Trail.Enabled = false
task.wait() -- Wait for the next Heartbeat frame. This doesn't happen if it's immediate.
Base.CFrame = CFrame.new(0, 0, 0)
Base.Trail.Enabled = true

local r = 0
while true do
    task.wait()
    r += 5
    Base.CFrame = CFrame.Angles(0, math.rad(r), 0) * CFrame.new(0, 6, 6)
end

SHAREX_1646275064

Issue Area: Engine
Issue Type: Display
Impact: Moderate
Frequency: Constantly

3 Likes

I haven’t quite tested this 100%, but I’m pretty sure this also happens with Beams. I’ve done some testing with beam objects a month ago and I came across the same effect when I used the wrong equation in positioning the other side of the beam.

Thanks for the report! FIled an internal ticket.

2 Likes

Seems like this has been solved!

Instead of the previous behavior, where it would disappear for a few seconds after it came back from at least over 5e18 studs away from origin/where it was, it immediately resumes, and if it’s too high it will ignore creating the trail (pictured A), or if it’s lower than approx 5e18, it will appear in picture B.

The undocumented and confusing invisibility is what caused issues when developing a feature based around a custom PartCache implementation for bullets with trails.

image

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.