NewtonMaterialSetCollisionCallback not working anymore?

Report any bugs here and we'll post fixes

Moderators: Sascha Willems, Thomas

NewtonMaterialSetCollisionCallback not working anymore?

Postby Schmackbolzen » Sat Apr 23, 2016 8:22 am

I just noticed that with newer Newton versions my callbacks don't get called anymore. If I use one checked out last September it still works. Has there been any changes that broke the callbacks? Or do I need to change anything?
Schmackbolzen
 
Posts: 26
Joined: Mon Feb 16, 2015 5:37 pm

Re: NewtonMaterialSetCollisionCallback not working anymore?

Postby Julio Jerez » Sat Apr 23, 2016 9:01 am

I do not recall make any change there, what call back is no called?
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: NewtonMaterialSetCollisionCallback not working anymore?

Postby Schmackbolzen » Sat Apr 23, 2016 9:22 am

I only use the last parameter "NewtonContactsProcess processCallback". The collisions I tested with are compound collisions.
Schmackbolzen
 
Posts: 26
Joined: Mon Feb 16, 2015 5:37 pm

Re: NewtonMaterialSetCollisionCallback not working anymore?

Postby Julio Jerez » Sat Apr 23, 2016 10:07 am

as far as I know it is called, is the body is sleeping

I just try the compound collision demo, and when I set a break point here
void OnGettingTheCollisionSubShapeFromMaterialCallback (const NewtonJoint* const contactJoint, dFloat timestep, int threadIndex)

the call back is called, di you take a looked at the compound collision demo? nothing has change there
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: NewtonMaterialSetCollisionCallback not working anymore?

Postby Schmackbolzen » Sat Apr 23, 2016 10:40 am

I guess I'll need to dig deeper to see what happens here. The simulation is fine and both bodies interact normally (meaning they collide and both move etc). The thing is I just switch the .dll files against the newer versions and the callbacks don't get called anymore. The rest stays the same.
Schmackbolzen
 
Posts: 26
Joined: Mon Feb 16, 2015 5:37 pm

Re: NewtonMaterialSetCollisionCallback not working anymore?

Postby Julio Jerez » Sat Apr 23, 2016 11:24 am

the callback is call form here: file ...\coreLibrary_300\source\physics\dgNarrowPhaseCollision.cpp

lines 859 and 653, one if code new contact and other for cached contacts , you can asset break point there and see that the callback point is there or not.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: NewtonMaterialSetCollisionCallback not working anymore?

Postby Schmackbolzen » Sat Apr 23, 2016 12:30 pm

Line 857 gets hit but "if (material->m_processContactPoint)" is always false since m_processContactPoint is 0. I set a breakpoint at NewtonMaterialSetCollisionCallback and noticed the parameter is also zero there. I then saw that you removed the userData pointer, which the old version had. The commit is https://github.com/MADEAPPS/newton-dyna ... ccc8033d23. I am using freepascal, so the header unit had to be updated. Now it works again. I guess I have to regenerate the unit completely, just to be sure nothing else got broken.

Thanks for the quick response, that really helped!
Schmackbolzen
 
Posts: 26
Joined: Mon Feb 16, 2015 5:37 pm

Re: NewtonMaterialSetCollisionCallback not working anymore?

Postby Julio Jerez » Sat Apr 23, 2016 12:47 pm

oh I see, yes I spate the user data form the pointer call backs. This make the interface more flexible
you use like this now
Code: Select all
   PassiveRagDollManager (DemoEntityManager* const scene)
      :CustomArticulaledTransformManager (scene->GetNewton())
   {
      // create a material for early collision culling
      m_material = NewtonMaterialCreateGroupID(scene->GetNewton());
      NewtonMaterialSetCallbackUserData (scene->GetNewton(), m_material, m_material, this);
      NewtonMaterialSetCollisionCallback (scene->GetNewton(), m_material, m_material, OnBoneAABBOverlap, NULL);
   }


your need to recompile your wrapper, sorry about that.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: NewtonMaterialSetCollisionCallback not working anymore?

Postby Stucuk » Thu May 05, 2016 6:23 pm

Schmackbolzen wrote:I am using freepascal, so the header unit had to be updated. Now it works again. I guess I have to regenerate the unit completely, just to be sure nothing else got broken.


Its always best to keep a copy of the Newton.h file so when you use a new DLL that you can compare its Newton.h to the old DLL's one to see if anything has changed.
User avatar
Stucuk
 
Posts: 801
Joined: Sat Mar 12, 2005 3:54 pm
Location: Scotland


Return to Bugs and Fixes

Who is online

Users browsing this forum: No registered users and 4 guests

cron