ndContactSolver::m_notification null

Report any bugs here and we'll post fixes

Moderators: Sascha Willems, Thomas

ndContactSolver::m_notification null

Postby Esharc » Mon Apr 04, 2022 9:06 am

Hello Julio,

I have a problem when I call
Code: Select all
CalculateContacts(const ndShapeInstance* const instanceA, const ndMatrix& matrixA, const ndVector& velocA, const ndShapeInstance* const instanceB, const ndMatrix& matrixB, const ndVector& velocB, ndFixSizeArray<ndContactPoint, 16>& contactOut)


In the CalculateContacts function you set m_notification = nullptr, but later on you call m_notification->OnCompoundSubShapeOverlap. But this causes a crash since m_notification is a nullptr.

Can you possible add a member in that function so that the notification callback can be sent through as an argument in the CalculateContacts function?

I see though upon further investigation that the problem may be deeper than just the notify callback. The bodies for the two shapes that get sent in are also created in the function, and they do not have the ndBodyNotify set. So I do not have my user data which I am using in the overlap callback for the two shapes.
Esharc
 
Posts: 120
Joined: Tue Jan 10, 2017 5:23 am
Location: South Africa

Re: ndContactSolver::m_notification null

Postby Julio Jerez » Mon Apr 04, 2022 10:46 am

What function is that.
I mean what file line number?

You mean the same function taking a notification callback as argument.

That seem a reasonably thing yes.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: ndContactSolver::m_notification null

Postby Esharc » Mon Apr 04, 2022 10:50 am

It is in ndContactSolver.cpp line 4297.
Esharc
 
Posts: 120
Joined: Tue Jan 10, 2017 5:23 am
Location: South Africa

Re: ndContactSolver::m_notification null

Postby Julio Jerez » Mon Apr 04, 2022 10:56 am

It seems checking for null solve the crash, but would introduce a different behavior like generating a different set of contacts. This could be in case where one can set shape that act as triggers.

I will check it out.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: ndContactSolver::m_notification null

Postby Esharc » Mon Apr 04, 2022 11:02 am

Thank you, yes it is basically that. It is happening with the "ghost" objects that we create that does not have a body, only a shape
Esharc
 
Posts: 120
Joined: Tue Jan 10, 2017 5:23 am
Location: South Africa

Re: ndContactSolver::m_notification null

Postby Julio Jerez » Mon Apr 04, 2022 1:13 pm

ok if you sync the function now take a pointer to a notify callback object.

the test is in file ..\newton-4.00\applications\ndSandbox\toolbox\ndDebugDisplay.cpp line 232
under define D_TEST_CALCULATE_CONTACTS

to call it from the menu you select show contacts.

I place it there, because that that takes that callback object, the compound are one lever recursive so it will call itself it is called from and notify callback. we could probably add some flag but I just moved out, since it does not seem to make sense to call contact from a contact.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: ndContactSolver::m_notification null

Postby Esharc » Tue Apr 05, 2022 6:04 am

Thank you, that fixed the problem
Esharc
 
Posts: 120
Joined: Tue Jan 10, 2017 5:23 am
Location: South Africa


Return to Bugs and Fixes

Who is online

Users browsing this forum: No registered users and 22 guests