Checking for volume interference

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Checking for volume interference

Postby misho » Fri Jun 02, 2017 1:46 pm

Within my application, I am building a scene dynamically (adding/linking Newton bodies). Sometimes, when I want to dynamically add a body and hard-link it to another body, there might be another body that interferes spatially (by volume) with the new body. So, for example, let's say I am building a mech robot by adding its components dynamically, in a "Mech designer" mode:

1: [Mech Head type 1] is linked to [Mech Torso].
2: Adding [Shoulder RocketPack Type 1] to Left shoulder hardpoint
3: Warning: [Shoulder Rocket Pack Type 1] is too large for this hardpoint. Try a different location or different weapon.

I don't want to implement some kind of a database that cross-checks fits to all the different components. I'd like to be notified if one body violates the volume of another body, and on this notification reject the link.

How can I do that?
Misho Katulic
CTO, FSX SpacePort
TerraBuilder
www.terrabuilder.com
misho
 
Posts: 673
Joined: Tue May 04, 2010 10:13 am

Re: Checking for volume interference

Postby Julio Jerez » Fri Jun 02, 2017 2:15 pm

if I understand, you want to know how much two object penetrates.
This is hard to measure for general objects, for convex objects you can use the closest distance,

if the are disjoint the do no touch, If the are colliding, the function I believe report the penetration.
I do not remember if the value is clamped, but that would ne the way of doing it. look at the interface

basically you use NewtonBodiesonAABB, anf iterate over each body, and each shape find the penetration distances.

for no convex is much harder, by since in newton each shape is mad of convex sub shapes this is also possible but not exposed, Newton 3.14 used that tenicque for trivial rejection test.

Newton 3.14 is the first version for newton that does not do trivial rejection of any kind other that the broad phase rejection, it generates more pair, but is much cleaner.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Checking for volume interference

Postby misho » Fri Jun 02, 2017 3:45 pm

Julio Jerez wrote:if I understand, you want to know how much two object penetrates.


Actually, no, I don't care how much they penetrate. All I want to know is, when I added an object, was there another object nearby that the new object collided with, and caused a collision. Basically, a Newton Body callback that notifies me if/when the body experienced the collision.

If the collision happened, then I'd remove that body and notify user that this body is incompatible with that location.

I'd also be able to dynamically activate/deactivate this notification so that it is only used in "assembly" stage.

I don't think AABB would work - they are quite a rough approximation of the object's volume, and my "tolerances" can be quite tight.
Misho Katulic
CTO, FSX SpacePort
TerraBuilder
www.terrabuilder.com
misho
 
Posts: 673
Joined: Tue May 04, 2010 10:13 am

Re: Checking for volume interference

Postby Julio Jerez » Fri Jun 02, 2017 5:10 pm

There are not newton call back that do that kind of user specific functionality, you nee to use a combinations of calls, but the procedure is the same as I explained above, unless I am not understanding the problem.
You take a AABB around the new object, and you call OnAABBOvererlap
that's your course resolution, then the call back that you pass to the call, you iterate over there collision shapes of each body calculation closest distance or the contact points, If they collide the contact count will be different than zero.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Checking for volume interference

Postby misho » Sat Jun 03, 2017 2:19 pm

Julio Jerez wrote:You take a AABB around the new object, and you call OnAABBOvererlap
that's your course resolution, then the call back that you pass to the call, you iterate over there collision shapes of each body calculation closest distance or the contact points, If they collide the contact count will be different than zero.


Ok - unless I am understanding something wrong about AABB, that approach won't work - here's why:

Image

On the left, the AABB overlap of 2 cylinders in proximity would register as collision, when in fact it is not... correct?

I'm looking to detect the situation on the right, when an object is placed in such a proximity of another object so that it violates its volume (blue area). I need to be able to warn/reject this object placement.

[EDIT] Ok - I re-read you answer and see what you meant - you mean to use AABB overlap as a starting point, and then cycle through the actual collision shapes and check for contacts? OK - that makes sense :mrgreen:
Misho Katulic
CTO, FSX SpacePort
TerraBuilder
www.terrabuilder.com
misho
 
Posts: 673
Joined: Tue May 04, 2010 10:13 am

Re: Checking for volume interference

Postby Julio Jerez » Sat Jun 03, 2017 3:18 pm

misho wrote:[EDIT] Ok - I re-read you answer and see what you meant - you mean to use AABB overlap as a starting point, and then cycle through the actual collision shapes and check for contacts? OK - that makes sense

yes that.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 14 guests

cron