Question about tweaking collision solving

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Question about tweaking collision solving

Postby sinisa » Tue Jun 22, 2010 3:15 am

Hi all,

I wonder if it is possible in newton to upon collision detection, and after AABB overlap & contact is processed, body can continue it's trajectory without bouncing off the surface or sliding along the surface?

Basically, I've been looking for solution where:

- I have bunch of particles flying in one direction (sand-looking ones)

- When they hit a specific surface, i do not want them in that case to bounce off, or slide-along surface, but to continue through it, just like they would if collision for materials would be off. BUT, I still want to have callbacks for AABB overlap and contact processing (when particle hits the surface, before going through it), in which moment I am testing particle velocity and casting additional particles on that spot.

My thought was that in the moment of impact, change material ID of original particle to a material that has no collision with material of that specific surface, but I'd rather like to ask someone experienced with Newton, what would be best approach.

Thanks in advance.
sinisa
 
Posts: 12
Joined: Mon Nov 09, 2009 11:26 am

Re: Question about tweaking collision solving

Postby Stucuk » Tue Jun 22, 2010 4:45 am

You just need to return 0 in the AABBOverlap
User avatar
Stucuk
 
Posts: 801
Joined: Sat Mar 12, 2005 3:54 pm
Location: Scotland

Re: Question about tweaking collision solving

Postby sinisa » Tue Jun 22, 2010 4:48 am

Stucuk wrote:You just need to return 0 in the AABBOverlap


Thanks for quick reply, however that is not what I am looking for.

I said I need to process contact, so AABB must return 1.

But I do not want that after contact is processed, body bounces off/slides-along obstacle, but to continue it's trajectory like nothing happened.

Purpose of this is that I need to process contact joint, and cast additional particles in that place.
sinisa
 
Posts: 12
Joined: Mon Nov 09, 2009 11:26 am

Re: Question about tweaking collision solving

Postby sinisa » Tue Jun 22, 2010 5:00 am

p.s.

I've attached image to better explain what I'm looking for.
Attachments
newton_particles.png
collision tune up problem
newton_particles.png (20.8 KiB) Viewed 2476 times
sinisa
 
Posts: 12
Joined: Mon Nov 09, 2009 11:26 am

Re: Question about tweaking collision solving

Postby Stucuk » Tue Jun 22, 2010 5:07 am

Don't think that would be possible. Julio is proberly the only person who would know.
User avatar
Stucuk
 
Posts: 801
Joined: Sat Mar 12, 2005 3:54 pm
Location: Scotland

Re: Question about tweaking collision solving

Postby sinisa » Tue Jun 22, 2010 5:12 am

Stucuk wrote:Don't think that would be possible. Julio is proberly the only person who would know.


Thanks, hope Julio can let us know.

Particles are often treated as firm bodies, they bounce off or slide along surfaces. But in case of sand and fabric, I need sand to react when colliding with thin material (fabric) but still to go through it (like collision was turned off for that material pair) while generating more 'sand splashes' depending on the velocity in the moment of impact.

Not sure if it can be done with this switch-material-id workaround I've mentioned, or if there is some better way to do it.

I'm currently trying that approach out, but I don't get desired results.

p.s.

also, primary particles are most likely NOT going along straight line, so any ray-casting is not doable. there are lot of other influences, like air resistance, wind, gravity, that make particles move along curved paths.
sinisa
 
Posts: 12
Joined: Mon Nov 09, 2009 11:26 am

Re: Question about tweaking collision solving

Postby JernejL » Tue Jun 22, 2010 5:16 am

can't you just simulate your own particles and use raycasting?
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1587
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

Re: Question about tweaking collision solving

Postby sinisa » Tue Jun 22, 2010 5:26 am

Delfi wrote:can't you just simulate your own particles and use raycasting?


sure, but then what's the point of using newton? just for raycasting?

p.s.

as i've mentioned, there's lot of other things in the scene, like air resistance, gravity, wind, other bodies (that do need 'normal' collision detection with particles) etc... and since newton already does collision detection, i'm just looking for a way to say "ok, thanks for contact joint, but now ignore all other collisions for this particle with this body, proceed like nothing happened".
sinisa
 
Posts: 12
Joined: Mon Nov 09, 2009 11:26 am

Re: Question about tweaking collision solving

Postby Julio Jerez » Tue Jun 22, 2010 7:06 am

oh yes you can do that quite easylly, if you look at the demo SpecialTrackJoint, there is a tracked vehicle that filter redundance contacts from friction tracks,
it uses the function NewtonContactJointRemoveContact from the solver stage. but it can also be used at the contact procsses too since what the function does is that remove ar row from the joint

you can try something like this:
make a material for particle and the objetes you want the particle to ignore and set a callback like this
Code: Select all
void ParicleContactProcess (const NewtonJoint* contactJoint, dFloat timestep, int threadIndex)
{
   void* nextContact;
   NewtonWorld* world;

   world = NewtonBodyGetWorld (NewtonJointGetBody0(contactJoint));
   // lock the world in case you are using mutithread
   NewtonWorldCriticalSectionLock(world);
   for (void* contact = NewtonContactJointGetFirstContact (contactJoint); contact; contact = nextContact) {
      nextContact = NewtonContactJointGetNextContact (contactJoint, contact);
      // do you special coding to test if this conat is to be rejected
      if (IsThisContactAcceted()) {
         NewtonContactJointRemoveContact (contactJoint, contact);
      }
   }
   // unlock the world in case you are using mutithread
   NewtonWorldCriticalSectionUnlock(world);

}
Julio Jerez
Moderator
Moderator
 
Posts: 12426
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 2 guests

cron