Trailmesh artifacts

repro: Babylon.js Playground

just keep hitting Run, you should see a black spider web thingy stretching from the ground to the sphere. If you initialize it to false, via

let trail = new BABYLON.TrailMesh('ball trail', sphere, scene, 0.1, 5, false);
trail.start();

the same artifact appears. It appears to be caused by the update func, this shouldn’t be wai ?

Hi !

Because your sphere WorldMatrix has not yet been updated when you create the TrailMesh, it generates a first point at (0, 0, 0).

Forcing a worldMatrix computation on the sphere partialy solves the issue (there’s still a quad that flashes for a frame, not sure why)

2 Likes

Yes, yer right! I missed that, shards! If the ground is removed (in the original pg), the quad also flashes for a frame, my guess is the trailmesh being all compressed at said point before the update hits. That is much easier to code a workaround tho. Thanks, marking as solved!