sable Posted December 7, 2016 Share Posted December 7, 2016 I have question regarding the tracking of nodes in a scene with canvas2d elements (using ScreenSpaceCanvas2D). It seems that when a node goes behind the camera, the 2d element will initially go out of view, but will eventually re-enter if you keep moving away from the node that it is attached to. An example playground below, which is a very slight modification of a playground from the documentation, demonstrates this. Just pan forward through the cubes (with ctrl + click), and the rectangle2ds initially go out a view, but then come back onto the screen. http://babylonjs-playground.com/#1N9RJY#61 Is this the desired behaviour? Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted December 7, 2016 Share Posted December 7, 2016 Ping @Nockawa Quote Link to comment Share on other sites More sharing options...
Wingnut Posted December 7, 2016 Share Posted December 7, 2016 All this pinging going-on... it's just so... so... pingful! Ok, I have no solve, and I have raised this z-indexing issue before, and I think it is still being studied. I have a work-around. It is not pretty. Camera starts in the MIDDLE of the circle of boxes... http://babylonjs-playground.com/#1N9RJY#63 Okay, the most important line is... line 21. I think the professionals call this a "back-reference". I store the tag (the group2d) IN the cube.tag property (which didn't exist until I created it, so it is an "overload"). The back-ref is used in a isInFrustum tester in the render loop... lines 53-64. A clumsy workaround kludge... but... it's still better than peeing on your foot. We still see some labels jumping because... Canvas2d primitives turn ON first, and THEN move to their trackedNode's position. They move after activation. It would probably be better if all group2d moved to their trackNode position FIRST, and then the .levelVisible activate them. Nockawa will visit soon, I suspect... and drop a few words on us. Nabroski 1 Quote Link to comment Share on other sites More sharing options...
sable Posted December 8, 2016 Author Share Posted December 8, 2016 Thanks for that work-around. For my usage it seems to perform well enough, and the flicker of labels on first load is just a minor gripe. Quote Link to comment Share on other sites More sharing options...
Wingnut Posted December 9, 2016 Share Posted December 9, 2016 Cool. Some label flickering can be seen with certain odd camera moves, too (well-after scene start). I think it is caused by the same reason. Setting a tag.levelVisible = true... probably follows the same turn-on sequence as initial startup (display first, then move to trackedNode screen position, after). In other words, when tag.levelVisible = false... the group2d likely releases its trackedNode and goes stupid. When we turn it BACK-on, it needs to re-calc where its trackNode is located. Not sure about that, but it seems logical and explains the seen anomaly. *shrug* I think I'll ping @Nockawa in case he wants to read what we are talking, here. He's the author of the Canvas2D system (still in dev), and he might have some words of wisdom for us. Now he has been "pinged". I typed '@' and then 'N'... and then 'o'... and then... a list opens in the forum software, and allows me to select names from that list. I selected Nockawa from the list, and it put that blue nametag in this post, and also possibly notified him that we spoke his name in a comment. (the ping/notification). A little instruction for anyone who isn't familiar with this brand of forum software. Although currently not-working, we have system called the debug layer, too. When working, you can turn it on with a playground button (currently broken) or with code (scene.debugLayer.show() after including inspector.js in your project). The debug layer has a choice called "show clickable labels". When that starts working again, take a look at THAT labeling method. It uses old-style HTML tags with absolute positioning, I believe. Works quite well. The BJS debugLayer went through a major re-code VERY recently... and now uses the brand new "inspector" system. If you decide to study it thoroughly, come back and teach us about it, okay? Lastly, nobody has really welcomed you to the forum, @sable. Soooo... welcome to the forum, Sable! Good to have you with us! Be well, we'll talk again soon, party on! Quote Link to comment Share on other sites More sharing options...
Nockawa Posted December 9, 2016 Share Posted December 9, 2016 Sorry folks, I can't help right now, I'm sick and I have order to stay away from computer... as soon as I feel better I'll answer/fix the issue, for the moment being, rest is all I can do to recover. Quote Link to comment Share on other sites More sharing options...
Nabroski Posted December 9, 2016 Share Posted December 9, 2016 @Nockawa Gute Besserung! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.