Jump to content

Get billboardmode in canvas2D with WorldSpaceCanvas2D


babaorhum
 Share

Recommended Posts

Hello every one,

I try to reproduce some feature from http://babylonjs-playground.com/#1KYG17#1

and here I am http://babylonjs-playground.com/#1MVIGI#4

I cannot get my canvas2D to have some kind of billboardmode 

As you can see, I ended copy pasting most of the first playground properties into the second one with no result so far

It seems that trackNodeBillboard expect a boolean according to babylonjs github but I may be wrong

parenting the canvas2d to sphereM (biggerbox) does not follow the move,

I don't know what I'm doing wrong

Thanks to all of you

Link to comment
Share on other sites

Hi again, B!  Um... first, I think you meant to reference #5 playground instead of #4.  #4 playground has no canvas2d stuff.  :)  If you wish, you can edit your previous post, and then I will adjust THIS post (removing my previous sentence).  Your choice.

Here's the fix for your #5 issue...

http://babylonjs-playground.com/#1MVIGI#7

Temporarily, I rounded the corners on your panel a bit more, just so we remember it is not a mesh, but instead a canvas2d.

Variable canvas, in this case, is a WorldSpaceCanvas2D... which is not a mesh (although it DOES have a .worldSpaceCanvasNode helper-mesh).  So, the "parent" set in line 73... would need to be a canvas2d entity, and NOT a mesh like sphereM.

Then, I set trackNode to sphereM in line 72, and it started working.  The panel was positioned inside-of the sphereM box, so I made sphereM semi-transparent so we could see it do billboarding.  (It needs some Z value set in line 70... to exit the box, as you likely know already.)  :)

Hope this helps. Sorry for slow reply.  Holler if you have more questions on this subject.  I like your "reveal" system, including your camera.radius monitoring.  Pretty cool!  Be well.

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