JohnK Posted January 25, 2017 Share Posted January 25, 2017 In this PG http://www.babylonjs-playground.com/#N4TFF I get lots of things I do not expect. Probably because I do not fully understand what I am doing or what I should expect, or maybe not! The little boxes indicate the points at which I am trying to find the closest facet. My expectations. Using show partitions would show partitions that would match the shape of the mesh. Using the values for (x, y, z) given they would all return an index as they are all close to the mesh. (See console results for box2 and box4) Different positions of (x, y, z) would return different index numbers. (see console results for box1 and box3) The projected variable would be non zero. Sorry @jerome but I think this is just for you. Am I missing the point somewhere and doing something wrong (most likely)? Is it because I am using an extruded mesh with a few large facets? Quote Link to comment Share on other sites More sharing options...
jerome Posted January 25, 2017 Share Posted January 25, 2017 Well, there some things here ... http://www.babylonjs-playground.com/#N4TFF#2 You forgot to pass the reference of the vector "projected" to getClosestFacetAtCoordinates(x, y, z, projected) so it can be set the right values. And you're right : the extrusion facets are too big for the internal partitioning. I set it to 3 instead. But, you're not in the best configuration to get accurate results for some collisions with facetData here. It would better to have far smaller facets (or more numerous) in the extrusion mesh, imho. Quote Link to comment Share on other sites More sharing options...
jerome Posted January 25, 2017 Share Posted January 25, 2017 http://www.babylonjs-playground.com/#N4TFF#3 I just changed a bit the model shape so it's not built on x = 0 and we get a result for projected4 now. The number of facets and their size bring to too limit cases here. A simple AABB algo would probably better for this kind of collisions. Quote Link to comment Share on other sites More sharing options...
JohnK Posted January 25, 2017 Author Share Posted January 25, 2017 Thank you @jerome for that. What a dummy to forget to add projected to the function What I am working towards doing is looking at where the two shapes as in http://www.babylonjs-playground.com/#N4TFF#4 will touch. Am currently thinking of using the central point of the overlap of the bounding boxes and seeing how far it is from the closet facets to it, or something like that. Thanks to you I now have a better idea of what to do with projection and partitions. 1 hour ago, jerome said: I just changed a bit the model shape so it's not built on x = 0 and we get a result for projected4 now. Does this mean I cannot use negative positions? Will keep playing and find out where the limits are. Quote Link to comment Share on other sites More sharing options...
jerome Posted January 25, 2017 Share Posted January 25, 2017 of course, you can use negative positions... Well in your case, we had a conjunction of very specific cases : the mesh located at x = 0, the partitioning edge at x = 0 and a big facet, maybe too big for the block actually it should even work better with facets distributed everywhere in the mesh local space I'm thinking about a way to improve the facet storing in the partitioning : to store facets near the block edges also in the adjacent blocks (blocks touching the current block), but I'm afraid this impacts the dynamic partitioning in the case of mesh morphed each frame (a lot of tests to do : each facet is tested on its 3 vertices + its center and there are 26 adjacent blocks to a given 3D block !) 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.