Connect points with a mesh

Hi, I was looking for a way to create an editable mesh witch connect some points.
So given a couple of objects, connect them via another mesh. I tried editing an existing polyhedron too.
But it seems to have too many vertices… so maybe building every triangle is better?
PG: https://playground.babylonjs.com/#L8TP5D#1

1 Like

The simplest is to create a custom polyhedra: Creating Custom Polyhedra | Babylon.js Documentation

Or you could create as you said your mesh manually:

1 Like

Do you want to be able to edit the vertices of the mesh once you create them, like dragging them around to change the shape of the mesh?

I can make a example for you :slight_smile:

3 Likes

Yes, would be cool, I need a way to update them too! Thanks

1 Like

@msDestiny14 Just making sure you saw this :slight_smile: (I would also love to see this example)

1 Like

Yep. Thanks for the ping :wink: I’ll get something for you I can show real soon. :slight_smile:

1 Like

Ok! Here is attempt #1 just so we can get the ball rolling a little bit.

https://playground.babylonjs.com/#PBLS4Y#237

Here is my version. I did similar to you where I created a primitive and attached boxes on all the vertices. Then I created gizmos and attached them to the boxes. Next I update each vertices each frame to match the gizmo’s position when I move it.

Note it still has the original problem of too many vertices. This is because each vertices is repeated multiple times depending on how many connecting points you have to it. The solution will be we must group those matching vertices so we’re only created one box per unique point. Then for each update match it to the corresponding duplicates. I try to come up with a way to best do this.

1 Like

Yep, I was trying to: Babylon.js Playground
Seems like there is an ordering issue or something when updating…
The idea was to create at attribute for every cube wich contains the index of vertex data
and then when the cube moves, update the relative indexes

Yep, was a dumb error. Works: https://playground.babylonjs.com/#8QL4XQ#2

2 Likes