Getting all intersections with a compound collision.

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Re: Getting all intersections with a compound collision.

Postby MeltingPlastic » Wed Apr 10, 2019 2:45 pm

Thanks Julio,

This makes sense to me. can I just use RayCastsCompoundsAllSubShapes directly in the filters/callbacks?

I'll look at integrating this when I have time. It should be super useful.
MeltingPlastic
 
Posts: 237
Joined: Fri Feb 07, 2014 11:30 pm

Re: Getting all intersections with a compound collision.

Postby Julio Jerez » Wed Apr 10, 2019 3:00 pm

MeltingPlastic wrote:can I just use RayCastsCompoundsAllSubShapes directly in the filters/callbacks?


I suppose you could do that but why would you want to make two nested callback when you can simply make a callback and them operate on the result of that callback.
Look at the function is not that complex

Code: Select all
   void RayCastCompoundsAllSubShapes(const dVector& origin, const dVector& end)
   {
      m_param = 1.0f;
      m_body = NULL;
      NewtonWorld* const world = GetWorld();
      NewtonWorldRayCast(world, &origin[0], &end[0], PickCompound, this, NULL, 0);
      if (m_body) {
         // we found a compound, find all sub shape on teh path of the ray
.....
....
         dMatrix matrix;



RayCastCompoundsAllSubShapes would be a more complex General Raycast interface for your engine,
either add flags of make it take an objects that operate on the result.

on the example I assuming the ray cast will search for the first compound that the ray hit, then if find one it will simply iterate over the sub shapes of the collision shape of that body tracing all the sub shapes of that compound brute force.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Getting all intersections with a compound collision.

Postby MeltingPlastic » Thu Apr 11, 2019 4:22 pm

Got it integrated. It seems to be working well!
MeltingPlastic
 
Posts: 237
Joined: Fri Feb 07, 2014 11:30 pm

Previous

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 11 guests