iiceman Posted February 12, 2015 Share Posted February 12, 2015 Hey ho, another two quick (and hopefully easy) question, please have a look here: http://www.babylonjs-playground.com/#GQDHN 1) I am trying to create a tiles ground with 4 submeshes. I start with zero submeshes. I am pushing submeshes 4 times... I end up with 8 submeshes... ... ... eh? I feel like I am missing something here, please tell me what's going on. I assume the 8 submeshes are the triangles that I see in the wireframe... but why? 2) How can I pick a submesh? The scene.pick returns the clicked mesh, but how would I determine the submesh at the clicked position? (Edit: I searched and didn't find anything about picking a submesh at all, but somebody must have done that before, I think. Maybe it's too easy so nobody else ever asked :-/ ) Easy questions, right? Enlighten me please! Quote Link to comment Share on other sites More sharing options...
RaananW Posted February 13, 2015 Share Posted February 13, 2015 Hi iiceman,1) as you said, you actively push the submashes to the array. This is already done for you in the submashes constructor so you are technically pushing the same object twice. Remove your push and it's be fine :-)2) at the current state it's not directly possible. But since you get a face id, it should be possible to calculate the sub mesh that you hit. Just make sure it's not -1 . Quote Link to comment Share on other sites More sharing options...
iiceman Posted February 13, 2015 Author Share Posted February 13, 2015 I see I see, thanks for the quick answer... for 1) I had the push thing from here: http://makina-corpus.com/blog/metier/2014/how-to-use-multimaterials-with-a-tiled-ground-in-babylonjs ... so I guess it just changed and this tutorial is not up to date? I am gonna try out as soon as I get home. for 2) calculating would be okay for me... but for other, more complex meshes with submeshes it would be nice to get the picked submesh in the pickResult, too. I think about something...can't be that hard to implement... I guess Quote Link to comment Share on other sites More sharing options...
RaananW Posted February 13, 2015 Share Posted February 13, 2015 It shouldn't be too hard to implement. It is already being checked, actually. the intersects function in AbstractMesh iterates each subMesh and checks for intersections. Returning the subMesh index is more than possible. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted February 14, 2015 Share Posted February 14, 2015 I would add that for you in the next push iiceman and Wingnut 2 Quote Link to comment Share on other sites More sharing options...
iiceman Posted February 14, 2015 Author Share Posted February 14, 2015 Awesome! Thanks a lot!! I had a short look at it today and I wasn't sure if I knew what to do... but didn't have time anyways..so if you can add it that's great news! 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.