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

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

Any solution?

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

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 - . 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.

1 Like

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.

You can use Create Parametric Shapes - Babylon.js Documentation

I used the parametric shapes but as I drag the spheres in this example , it creates more planes. Any Idea on how to update the path of a mesh instead of creating a new mesh?

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 ?

Change to only dispose of poly when drag finished?


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