# Resetting Trailmesh \[COMPLETED\]

**URL:** <https://forum.babylonjs.com/t/resetting-trailmesh-completed/52553>\
**Category:** Completed Features\
**Created:** [August 5, 2024, 8:06am UTC](https://forum.babylonjs.com/t/resetting-trailmesh-completed/52553 "2024-08-05T08:06:35Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![phaselock](https://avatars.discourse-cdn.com/v4/letter/p/da6949/32.png) [@phaselock](https://forum.babylonjs.com/u/phaselock)\
**Post date:** [August 5, 2024, 8:06am UTC](https://forum.babylonjs.com/t/resetting-trailmesh-completed/52553/1 "2024-08-05T08:06:35Z")

</div>

Repro: [Babylon.js Playground](https://playground.babylonjs.com/#RQOR1G)

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!

---

<div class="post-metadata">

**Author:** ![CrashMaster](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/crashmaster/32/23662_2.png) [@CrashMaster](https://forum.babylonjs.com/u/CrashMaster)\
**Post date:** [August 5, 2024, 8:37am UTC](https://forum.babylonjs.com/t/resetting-trailmesh-completed/52553/2 "2024-08-05T08:37:19Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![phaselock](https://avatars.discourse-cdn.com/v4/letter/p/da6949/32.png) [@phaselock](https://forum.babylonjs.com/u/phaselock)\
**Post date:** [August 17, 2024, 8:17am UTC](https://forum.babylonjs.com/t/resetting-trailmesh-completed/52553/3 "2024-08-17T08:17:18Z")

</div>

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](https://forum.babylonjs.com/t/seedborn-beta-is-launched/31379/56). Hope it helps, cheers!

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [August 19, 2024, 3:31pm UTC](https://forum.babylonjs.com/t/resetting-trailmesh-completed/52553/4 "2024-08-19T15:31:32Z")

</div>

Moved to done 😉
