Sign in to follow this  
mind0n

How to let GUI line link 2 meshes

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

Share this post


Link to post
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.

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.