# BABYLON.Mesh.CreatePlane mesh picking is not working in some orientation

**URL:** <https://forum.babylonjs.com/t/babylon-mesh-createplane-mesh-picking-is-not-working-in-some-orientation/10959>\
**Category:** Bugs\
**Created:** [May 19, 2020, 5:43am UTC](https://forum.babylonjs.com/t/babylon-mesh-createplane-mesh-picking-is-not-working-in-some-orientation/10959 "2020-05-19T05:43:49Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![mathus1](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/mathus1/32/8535_2.png) [@mathus1](https://forum.babylonjs.com/u/mathus1)\
**Post date:** [May 19, 2020, 5:43am UTC](https://forum.babylonjs.com/t/babylon-mesh-createplane-mesh-picking-is-not-working-in-some-orientation/10959/1 "2020-05-19T05:43:49Z")

</div>

I’ve got a problem for picking the plane I created. The picking feature works well in some angles but it does not work if I rotate it and pick it in another angle.

Here is the playground: [Babylon.js Playground](https://playground.babylonjs.com/#XB8EHF)

Any solution?

---

<div class="post-metadata">

**Author:** ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)\
**Post date:** [May 19, 2020, 10:06am UTC](https://forum.babylonjs.com/t/babylon-mesh-createplane-mesh-picking-is-not-working-in-some-orientation/10959/2 "2020-05-19T10:06:40Z")

</div>

So, took me a hile to understand what’s going on 🙂

You are creating a plane, and then using the same variable name to create a line mesh. The plane is still there, but in its original size and not stretched like you want it to be. To simulate that I created this - [https://playground.babylonjs.com/#XB8EHF#1](https://playground.babylonjs.com/#XB8EHF#1) . The plane I call “keep” is a copy of the plane that is used to create the line mesh.

I have to say that I am not sure a plane should be used this way to attach to a line mesh, thou I find your approach very refreshing :-). I believe this is not an issue with the pick system, but actually an issue with the lines mesh (that manipulates a plane in such a nice way). Will wait to see what others say before I dig into it.

---

<div class="post-metadata">

**Author:** ![mathus1](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/mathus1/32/8535_2.png) [@mathus1](https://forum.babylonjs.com/u/mathus1)\
**Post date:** [May 19, 2020, 12:51pm UTC](https://forum.babylonjs.com/t/babylon-mesh-createplane-mesh-picking-is-not-working-in-some-orientation/10959/3 "2020-05-19T12:51:54Z")

</div>

I was trying to find the best aproach to create planes for house tiling since I completed making the wall builder. Now Im stuck with the floor part since it requires many edges to fit the room shape. The more edges to manipulate the better, The maximum number of spheres I can use with this example is 4. While playing with some examples, I accidentally came across with this “solution”. To be honest I didnt even know what I was doing haha but it worked somehow. Thats a Beginners’s luck. Thank you for explaining what that code did.

---

<div class="post-metadata">

**Author:** ![JohnK](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/johnk/32/26764_2.png) [@JohnK](https://forum.babylonjs.com/u/JohnK)\
**Post date:** [May 20, 2020, 12:26am UTC](https://forum.babylonjs.com/t/babylon-mesh-createplane-mesh-picking-is-not-working-in-some-orientation/10959/4 "2020-05-20T00:26:05Z")

</div>

> [@mathus1](#):
>
> Now Im stuck with the floor part since it requires many edges to fit the room shape. The more edges to manipulate the better,

You can use [https://doc.babylonjs.com/how\_to/parametric\_shapes#non-regular-polygon](https://doc.babylonjs.com/how_to/parametric_shapes#non-regular-polygon)

---

<div class="post-metadata">

**Author:** ![mathus1](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/mathus1/32/8535_2.png) [@mathus1](https://forum.babylonjs.com/u/mathus1)\
**Post date:** [May 20, 2020, 3:19am UTC](https://forum.babylonjs.com/t/babylon-mesh-createplane-mesh-picking-is-not-working-in-some-orientation/10959/5 "2020-05-20T03:19:59Z")

</div>

I used the parametric shapes but as I drag the spheres in this example [https://playground.babylonjs.com/#4G18GY#190](https://playground.babylonjs.com/#4G18GY#190) , it creates more planes. Any Idea on how to update the path of a mesh instead of creating a new mesh?

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [May 20, 2020, 12:31pm UTC](https://forum.babylonjs.com/t/babylon-mesh-createplane-mesh-picking-is-not-working-in-some-orientation/10959/6 "2020-05-20T12:31:32Z")

</div>

I do not think that you can easily update path done with PolygonBuilder also , it might be a bit slow as constructing it might take a bit of time.

ExtrudeShape and such would let you update easily by passing back the shape as a ref in the create method if it is possible for your needs.

Maybe @JohnK knows a trick for it ?

---

<div class="post-metadata">

**Author:** ![JohnK](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/johnk/32/26764_2.png) [@JohnK](https://forum.babylonjs.com/u/JohnK)\
**Post date:** [May 20, 2020, 12:54pm UTC](https://forum.babylonjs.com/t/babylon-mesh-createplane-mesh-picking-is-not-working-in-some-orientation/10959/7 "2020-05-20T12:54:33Z")

</div>

Change to only dispose of poly when drag finished? [https://playground.babylonjs.com/#XB8EHF#6](https://playground.babylonjs.com/#XB8EHF#6)

---

<div class="post-metadata">

**Author:** ![mathus1](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/mathus1/32/8535_2.png) [@mathus1](https://forum.babylonjs.com/u/mathus1)\
**Post date:** [May 20, 2020, 1:47pm UTC](https://forum.babylonjs.com/t/babylon-mesh-createplane-mesh-picking-is-not-working-in-some-orientation/10959/8 "2020-05-20T13:47:52Z")

</div>

It worked well.I appreciate your effort in this. Thank you so much
