Tutorial tut_bouncing_ball Assertion Failed

Report any bugs here and we'll post fixes

Moderators: Sascha Willems, Thomas

Tutorial tut_bouncing_ball Assertion Failed

Postby alexiusnexus » Fri Sep 07, 2018 6:34 am

hi,

hope it's not a duplicate.
I've donloaded and build newtDyn package without problems (visualStudio_2015_dll DEBUG).
than I've compiled "doc/source/tut_bouncing_ball.cpp"

first error (on clean up):
Code: Select all
Debug Assertion Failed!

Program: ...o\Documents\development\Ogre\Win32Project1\Debug\newton_d.dll
File: ..\..\dgPhysics\dgWorld.cpp
Line: 380

Expression: dgBodyCollisionList::GetCount() == 0


next, for fun, I've scaled down the ground body/collider:
Code: Select all
- NewtonCollision* const cs_ground = NewtonCreateBox(world, 100, 0.1, 100, 0, NULL);
+ NewtonCollision* const cs_ground = NewtonCreateBox(world, 10, 0.1, 10, 0, NULL);


and I have this error:
Code: Select all
Debug Assertion Failed!

Program: ...o\Documents\development\Ogre\Win32Project1\Debug\newton_d.dll
File: ..\..\dgPhysics\dgWorldDynamicUpdate.cpp
Line: 278

Expression: contact->GetBody0()->m_invMass.m_w > dgFloat32(0.0f)


I'm sure I've forgot something.
Any help?
thanks ^_^
alexiusnexus
 
Posts: 2
Joined: Fri Sep 07, 2018 3:24 am

Re: Tutorial tut_bouncing_ball Assertion Failed

Postby Dave Gravel » Fri Sep 07, 2018 8:19 am

Edited:
If you need the debug dll, And if you like to avoid the assert.
You can define DG_DISABLE_ASSERT and rebuild the debug dll.
Just remember to re-enable it if you get other problems.
Last edited by Dave Gravel on Fri Sep 07, 2018 10:16 am, edited 1 time in total.
You search a nice physics solution, if you can read this message you're at the good place :wink:
OrionX3D Projects & Demos:
https://orionx3d.sytes.net
https://www.facebook.com/dave.gravel1
https://www.youtube.com/user/EvadLevarg/videos
User avatar
Dave Gravel
 
Posts: 800
Joined: Sat Apr 01, 2006 9:31 pm
Location: Quebec in Canada.

Re: Tutorial tut_bouncing_ball Assertion Failed

Postby Sweenie » Fri Sep 07, 2018 8:50 am

I suspect the first error is because the colliders aren't properly released.
When creating the bodies they increment the reference count for the colliders and release them when they are destroyed but the initial reference created by NewtonCreateBox & NewtonCreateSphere needs to be released as well.

After the bodies are created, try adding these two lines...

Code: Select all
NewtonDestroyCollision(cs_sphere);
NewtonDestroyCollision(cs_ground);


Regarding the second assert.
I think this may be because the ground is assigned a Force&Torque callback.
The ground is static(mass = 0) and has no inertia values so that callback does nothing.
Try removing this line.
Code: Select all
  NewtonBodySetForceAndTorqueCallback(ground, cb_applyForce);
Sweenie
 
Posts: 498
Joined: Mon Jan 24, 2005 7:59 am
Location: Sweden

Re: Tutorial tut_bouncing_ball Assertion Failed

Postby alexiusnexus » Fri Sep 07, 2018 9:36 am

First, Many thanks guys ^_^

Dave Gravel wrote:You can define DG_DISABLE_ASSERT

ok :)

Sweenie wrote:After the bodies are created, try adding these two lines...

Code: Select all
NewtonDestroyCollision(cs_sphere);
NewtonDestroyCollision(cs_ground);


this solve the problem, but now when application shut down I see this in output:
Code: Select all
Debug Assertion Failed!

Program: ...o\Documents\development\Ogre\Win32Project1\Debug\newton_d.dll
File: ..\..\dgCore\dgMemory.cpp
Line: 107

Expression: GetCount() == 0


Sweenie wrote:Regarding the second assert.
I think this may be because the ground is assigned a Force&Torque callback.
The ground is static(mass = 0) and has no inertia values so that callback does nothing.
Try removing this line.
Code: Select all
  NewtonBodySetForceAndTorqueCallback(ground, cb_applyForce);

Already tried. not working.

in any case I was just curious why this asserts in so simply tutorial example.
I'll keep use newton with my Ogre app.
we'll see ^_^

thanks again!
alexiusnexus
 
Posts: 2
Joined: Fri Sep 07, 2018 3:24 am


Return to Bugs and Fixes

Who is online

Users browsing this forum: No registered users and 8 guests