ViBe Posted June 30, 2016 Share Posted June 30, 2016 Hi, I try to apply this sample (http://babylonjs-playground.com/#1N9RJY#5) for polygons. So I want to know if the text can track a PolygonMeshBuilder. For the polygons, the texts have the same position (in 0, 0, 0) : http://www.babylonjs-playground.com/#1V3CAT#149 Thank you for your help Quote Link to comment Share on other sites More sharing options...
Nockawa Posted June 30, 2016 Share Posted June 30, 2016 Right now the tag is set to be positioned at 0,0,0 of the tracked Mesh frame of reference. If I'm not mistaken PolygonMeshBuilder generates a single Mesh. So I'm not quite sure of what you want to achieve. You want more than one text for a given mesh? I don't really understand what you would like to have, please give me more detail. Quote Link to comment Share on other sites More sharing options...
ViBe Posted June 30, 2016 Author Share Posted June 30, 2016 I would like to have something like this (one text for each PolygonMeshBuilder) : Do you think it's possible ? And if yes, how can I achieve this ? Thank you Quote Link to comment Share on other sites More sharing options...
Nockawa Posted July 1, 2016 Share Posted July 1, 2016 PolygonMeshBuilder create a new Mesh when you call the build() method. You can add a tracked group for this mesh. But if you create three separate entities with one single call to build(), you will only have one Group2D that can track them. I hope I'm clear enough Quote Link to comment Share on other sites More sharing options...
ViBe Posted July 1, 2016 Author Share Posted July 1, 2016 Sorry, maybe my english is not as good as I want it to be. Or But if I understand well, as I create 2 PolygonMeshBuilder like this: var poly1 = BABYLON.Polygon.Parse("-2 0 -2 2 -4 3 -6 2 -6 0"); var pmb1 = new BABYLON.PolygonMeshBuilder("poly1", poly1, scene).build(); var poly2 = BABYLON.Polygon.Parse("-12 -10 -12 -8 -14 -7 -16 -8 -16 -10"); var pmb2 = new BABYLON.PolygonMeshBuilder("poly2", poly2, scene).build(); I have two meshes (pmb1 and pmb2), so it should work. No ? Quote Link to comment Share on other sites More sharing options...
Nockawa Posted July 1, 2016 Share Posted July 1, 2016 yes it should! sorry, I just spent "more time" at your playground and you're right it should work, I didn't understand correctly the first time I read your post, I investigate right now. I'm in the middle of a move out to change country, I'm pretty busy right now! I get back to you in few minutes. Quote Link to comment Share on other sites More sharing options...
ViBe Posted July 1, 2016 Author Share Posted July 1, 2016 OK, thanks Quote Link to comment Share on other sites More sharing options...
Nockawa Posted July 1, 2016 Share Posted July 1, 2016 OK, I understood what's going on: Poly1 and Poly2 have the same World Position, so the two labels are overlapping and you only see one of them. I've changed the position of pmb2 in this PG: http://www.babylonjs-playground.com/#1V3CAT#150 you can see the three label now. What I think you should do: create each polygon mesh with their vertices relative to the 0,0,0 reference of frame (like you did for poly1 but not for poly2), then rely on the position property of the mesh to set the position where you want it to be. What you did is creating poly2 with vertices at a left position but at the same world position as poly1, which is not the best way to do what you're trying to. Quote Link to comment Share on other sites More sharing options...
ViBe Posted July 2, 2016 Author Share Posted July 2, 2016 OK I understand the workaround. I will add this translation step to have this great feature ! Quote Link to comment Share on other sites More sharing options...
Nockawa Posted July 3, 2016 Share Posted July 3, 2016 good! but note this is not a workaround, you're supposed to like that always, you will see that it eases lots of things after you get used to it. Quote Link to comment Share on other sites More sharing options...
ViBe Posted July 4, 2016 Author Share Posted July 4, 2016 It's because I have the list of polygons with the real coordinates. This is not natural for me to add this step . Maybe the constructor of PolygonMeshBuilder should include this parameter (at less as an option) if we are supposed to do like that ? Anyway, thanks ! it works. 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.