Resetting Trailmesh [COMPLETED]

Repro: Babylon.js Playground

Motivation: The current Trailmesh does not update the trail correctly when the generator mesh changes its position in one frame. Coupled with long trails, short paths and moving targets, this creates incoherent visuals breaking the effect where trail vertices are distorted due to the sudden change in generator position.

Proposal: Add a public reset function to the trailMesh class to allow trail vertices to reset to generator position.

Desired result: uncomment line 132 in above PG: trail.reset(); to see the difference.

Erm, basically, I just need approval to submit a PR for a reset function in the TrailMesh class. Not sure if reset is good enough for a function name or I should use a different name, since its kinda generic. Also, not sure if my approach towards the reset is correct, I’m just updating all position and normals to the first segment’s.

I’m open to ideas and feedback, lemme know. Thanks for reading!

3 Likes

I second this, I am having issues as well when using a floating origin as the central mesh needs to be brought back to the origin often!

1 Like

This PR is accepted in 7.21.0. Dunno how to close this, so just marked title as completed. Also, I made a little demo. Hope it helps, cheers!

4 Likes

Moved to done :wink:

2 Likes