Jump to content

How to let GUI line link 2 meshes


mind0n
 Share

Recommended Posts

Refer to the demo below, a GUI line can connect a mesh & a control at the same time by using: line.linkWithMesh(sphere);  line.connectedControl = rect1;

However, what I want to achieve is that let GUI line link with 2 meshes, each at the end of the line. (eg. line.linkWithMesh(sphere1, sphere2);

Is there any way to achieve this?

https://www.babylonjs-playground.com/#XCPP9Y#39

Link to comment
Share on other sites

Hiya M!  Hey, if the lines are NOT GUI... would that be okay? 

https://www.babylonjs-playground.com/#1EBCJY#3

GUI lines are not designed to connect mesh together, but, there still might be a way to do it.

I'll think real hard, and we'll listen for other ideas/help.  (Unless non-GUI lines will work.)

Unfortunately I don't think there is a thickness setting... for these non-GUI lines.

Others have done some things with thin cylinders... placed between mesh (between the mesh.positions, so cylinders can go INTO the mesh... to its origin/pivot-point).

Do a playground search for 'vend'.  I remember all the "cylinderBetweenPoints" experiments... used 'vend' as the name of the ending vec3 target.  :)

https://www.babylonjs-playground.com/#T7M9U#0   <- that is rather nice, and small.  But, as you can see, something changed in the newer versions of BJS... that make the cylinder NOT connect to the spheres.  hmmm. 

I'll see if I can fig why.  It might be due to some changes in setPivots.  Something about... changing pivots USE TO move the mesh, but in newer BJS, it doesn't.  Or the opposite of that.  I can't remember right now.  Help from others... welcome.  Stay tuned for more ideas.

Link to comment
Share on other sites

Hi @Wingnut,

Thanks for the feedback, your example looks great. 
However, I have to use a GUI line to connect 2 meshes.  That's because I need to keep all the lines at the background so the lines never display in front of any mesh no matter how user rotates the camera.
I really appreciate if GUI lines could support this feature (connect 2 meshes with a single line).

8 hours ago, Wingnut said:

Hiya M!  Hey, if the lines are NOT GUI... would that be okay? 

https://www.babylonjs-playground.com/#1EBCJY#3

GUI lines are not designed to connect mesh together, but, there still might be a way to do it.

I'll think real hard, and we'll listen for other ideas/help.  (Unless non-GUI lines will work.)

Unfortunately I don't think there is a thickness setting... for these non-GUI lines.

Others have done some things with thin cylinders... placed between mesh (between the mesh.positions, so cylinders can go INTO the mesh... to its origin/pivot-point).

Do a playground search for 'vend'.  I remember all the "cylinderBetweenPoints" experiments... used 'vend' as the name of the ending vec3 target.  :)

https://www.babylonjs-playground.com/#T7M9U#0   <- that is rather nice, and small.  But, as you can see, something changed in the newer versions of BJS... that make the cylinder NOT connect to the spheres.  hmmm. 

I'll see if I can fig why.  It might be due to some changes in setPivots.  Something about... changing pivots USE TO move the mesh, but in newer BJS, it doesn't.  Or the opposite of that.  I can't remember right now.  Help from others... welcome.  Stay tuned for more ideas.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...