Sign in to follow this  
JohnK

Partitions and projected used in facetData

Recommended Posts

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.

  1. Using show partitions would show partitions that would match the shape of the mesh.
  2. 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)
  3. Different positions of (x, y, z) would return different index numbers. (see console results for box1 and box3)
  4. 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?

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

Thank you @jerome for that. What a dummy to forget to add projected to the function:wacko:

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.

Share this post


Link to post
Share on other sites

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 !) 

Share this post


Link to post
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...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.