# How to move mesh by some line/mesh line

**URL:** <https://forum.babylonjs.com/t/how-to-move-mesh-by-some-line-mesh-line/56517>\
**Category:** Questions\
**Tags:** animation\
**Created:** [February 11, 2025, 2:28pm UTC](https://forum.babylonjs.com/t/how-to-move-mesh-by-some-line-mesh-line/56517 "2025-02-11T14:28:07Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![TooCalm](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/toocalm/32/3301_2.png) [@TooCalm](https://forum.babylonjs.com/u/TooCalm)\
**Post date:** [February 11, 2025, 2:28pm UTC](https://forum.babylonjs.com/t/how-to-move-mesh-by-some-line-mesh-line/56517/1 "2025-02-11T14:28:07Z")

</div>

Hey guys,

I want to add some liveness to my scene. I want to add some bugs which are moving by some cyclic route. How to create such route in babylon js?

I found such example [https://playground.babylonjs.com/#KBS9I5#81](https://playground.babylonjs.com/#KBS9I5#81) where dude move by some hardcoded points but it looks very unnatural.

Ideal solution for me is to have some imported mesh line and i use bug mesh to move on this line (bug’s face always looking forward by line vector) or to create line mesh in code but with natural angles (such line mesh is possible to create but how to move bug mesh by it?). Is it possible to do this in babylon js? The only thing i found is playground above. Or maybe there is a way to do this better?

Thanks!

---

<div class="post-metadata">

**Author:** ![labris](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/labris/32/12576_2.png) [@labris](https://forum.babylonjs.com/u/labris)\
**Post date:** [February 11, 2025, 2:53pm UTC](https://forum.babylonjs.com/t/how-to-move-mesh-by-some-line-mesh-line/56517/2 "2025-02-11T14:53:37Z")

</div>

Here is the PG with path following - [https://playground.babylonjs.com/#1YD970#583](https://playground.babylonjs.com/#1YD970#583)  
And some documentation - [Babylon.js docs](https://doc.babylonjs.com/guidedLearning/workshop/Car_Path/#following-the-path)

If you need more complex steering behaviors you may consider to use YUKA library - [Yuka | Examples with Babylon.js](https://yuka.babylonpress.org/examples/)

---

<div class="post-metadata">

**Author:** ![TooCalm](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/toocalm/32/3301_2.png) [@TooCalm](https://forum.babylonjs.com/u/TooCalm)\
**Post date:** [February 11, 2025, 3:11pm UTC](https://forum.babylonjs.com/t/how-to-move-mesh-by-some-line-mesh-line/56517/3 "2025-02-11T15:11:15Z")

</div>

Thank you very much. it looks like what i need but i found that it uses actual formula to draw a line. it’s a problem i need to draw a line by myself. and from Path3D documantation i found how to do that

> **[Babylon.js Playground](https://playground.babylonjs.com/#SGVUBC%2386)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL and WebGPU 3D scenes

Thanks for help

---

<div class="post-metadata">

**Author:** ![roland](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/roland/32/38940_2.png) [@roland](https://forum.babylonjs.com/u/roland)\
**Post date:** [February 11, 2025, 3:11pm UTC](https://forum.babylonjs.com/t/how-to-move-mesh-by-some-line-mesh-line/56517/4 "2025-02-11T15:11:22Z")

</div>

GreasedLineTools:

> **[Babylon.js Playground](https://playground.babylonjs.com/#H1LRZ3%23723)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL and WebGPU 3D scenes

[https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param/greased\_line/#finding-the-last-visible-position-on-the-line-when-using-the-visibility-option](https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param/greased_line/#finding-the-last-visible-position-on-the-line-when-using-the-visibility-option)

---

<div class="post-metadata">

**Author:** ![TooCalm](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/toocalm/32/3301_2.png) [@TooCalm](https://forum.babylonjs.com/u/TooCalm)\
**Post date:** [February 11, 2025, 3:27pm UTC](https://forum.babylonjs.com/t/how-to-move-mesh-by-some-line-mesh-line/56517/5 "2025-02-11T15:27:27Z")

</div>

Thanks! Greased line looks like more convenient way to work with it but i still need to prepare points for it manually  
Thank for help!
