How to reject contact in NewtonContactsProcess callback?

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

How to reject contact in NewtonContactsProcess callback?

Postby ravarcade » Sat Jul 18, 2015 12:13 pm

In old Newton lib (ver. 1.53) NewtonContactProcess can return 0 and stop processing on contact.
In newer lib this callback function can't return anything.
So question is how to implement same behaviour.

Background why i need it. Old game: Future Pinball uses Newton.dll ver 1.53. I try to upgrade it to new lib. Future Pinball is closed project. I don't have access to source. So all i do now is create midleware between FP and Newton.dll. Right now it almos work.
To the point. FP creates some object used as triggers. It uses NewtonContactProcess callback as place to take some actions. Right now if ball hit that object, ball is bounced from object.
I alredy try to use NewtonCollisionSetMode and disable collistion, but this way there is no action in game.

Any cluea how to in this callback reject collision?
ravarcade
 
Posts: 8
Joined: Sat Jul 18, 2015 11:52 am

Re: How to reject contact in NewtonContactsProcess callback?

Postby Julio Jerez » Sat Jul 18, 2015 1:43 pm

to reject contacts in the newer libraries you do it like this
Code: Select all
void GenericContactProcess(const NewtonJoint* contactJoint, dFloat timestep, int threadIndex)
{
   void* nextContact;
   for (void* contact = NewtonContactJointGetFirstContact(contactJoint); contact; contact = nextContact) {
      nextContact = NewtonContactJointGetNextContact(contactJoint, contact);
      if (some_special_test) {
         NewtonContactJointRemoveContact(contactJoint, contact);
      }
   }
}
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: How to reject contact in NewtonContactsProcess callback?

Postby ravarcade » Sat Jul 18, 2015 1:58 pm

Thanks. It works.
ravarcade
 
Posts: 8
Joined: Sat Jul 18, 2015 11:52 am


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 1 guest

cron