Jump to content

[Solved]2D forms in a 3D space


Borjan
 Share

Recommended Posts

Im investigating possibilities of porting the graphical part of an OpenGL desktop application to BABYLON.JS. The basic displaying went easy but (for me) the difficult part to create meshes that are 2D forms in a 3D space (please have a look into this 10 seconds video: https://www.youtube.com/watch?v=gFqANSbdtnE). Basically, the rectangles are always facing the camera, but in the same time are rotating and resizing with the entire scene. What would be the right (and hopefully the easiest) way to make that working?

Additionally, I would like to display tool tips (mesh names) on selected meshes (and when the mouse pointer hovers over a mesh). That part I could easily program myself (except for hovering), but only by using the 3.0 pre-release (see playground https://www.babylonjs-playground.com/index.html#RBP60B). Ive copied that solution from the GUI playground and it works just fine. Am I using this functionality properly?

Link to comment
Share on other sites

1 hour ago, Borjan said:

(except for hovering)

Check out http://doc.babylonjs.com/tutorials/how_to_use_actions and triggers which deal with whether pointer is over a mesh or not.

For GUI hovering check out http://www.babylonjs-playground.com/#XCPP9Y#121

Version 3 will be on release very soon so do not worry about using this version.

Link to comment
Share on other sites

1 hour ago, JohnK said:

Check out http://doc.babylonjs.com/tutorials/how_to_use_actions and triggers which deal with whether pointer is over a mesh or not.

For GUI hovering check out http://www.babylonjs-playground.com/#XCPP9Y#121

Version 3 will be on release very soon so do not worry about using this version.

Thanks John for for your input. However, the hovering is not really of a mayor concern and, moreover, I do not need to use GUI except for the "tool tips". Even that I would prefer to solve without involving yet another API set (a separate js library), but, if it is the way I have to do it, I'll do it.

My major concern is how to show rectangles (like in the YouTube video) instead of spheres in my visualization Check  https://www.babylonjs-playground.com/index.html#RBP60B

The red and white spheres need to be replaced with red rectangles and blue oval shapes respectively (as used in the video: https://www.youtube.com/watch?v=gFqANSbdtnE)

Link to comment
Share on other sites

15 hours ago, JohnK said:

Thanks John,

however, your example does not work. Everything rotates as without the billboard mode, looks like something has to be done in addition.

I've heard of it for the first time and checked other entries in this forum. Have a look into this: http://www.html5gamedevs.com/topic/28611-billboard-mode-solved/

I've extracted a piece of it and it behaves as it should be (if I understand well what the "billboard mode" means): http://www.babylonjs-playground.com/#QNG6Y1#1

Please comment!

Link to comment
Share on other sites

First of all my apologies as I made a mistake billboardMode should have a capital M (line 90) however even spelling it correctly would not give the correct results. It appears that billBoardMode does not work with instances without applying it to the instance https://www.babylonjs-playground.com/index.html#RBP60B#5

As an alternative you could use clone https://www.babylonjs-playground.com/index.html#RBP60B#4

This is also the first time I have played with billboardMode. I had read about it in the forum and thought it might help you. My attempt at a solution fell down a bit as it was late and I didn't check it.

I found the error by stripping out parts of your code bit at a time until the problem lay in a small section of code and so focusing on where the issue might be. A useful method for all of us.

 

Link to comment
Share on other sites

3 minutes ago, JohnK said:

First of all my apologies as I made a mistake billboardMode should have a capital M (line 90) however even spelling it correctly would not give the correct results. It appears that billBoardMode does not work with instances without applying it to the instance https://www.babylonjs-playground.com/index.html#RBP60B#5

As an alternative you could use clone https://www.babylonjs-playground.com/index.html#RBP60B#4

This is also the first time I have played with billboardMode. I had read about it in the forum and thought it might help you. My attempt at a solution fell down a bit as it was late and I didn't check it.

I found the error by stripping out parts of your code bit at a time until the problem lay in a small section of code and so focusing on where the issue might be. A useful method for all of us.

 

Thank you very much for your effort! Just one performance question. Is there any difference between using instances and using clones?

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