JV-ODE Physics Thread 6

Blitz3D Forums/Blitz3D Userlibs/JV-ODE Physics Thread 6

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.


The more objects I add the more likely the game will crash. The error give is memory violation on this line dSpaceCollide(Space,World,ContactGroup)


Quite a few things can cause SpaceCollide to MAV so it isn't always easy to pinpoint. It can happen if you create geoms inside the boundary of other geoms, for example adding more than one geom in the exact same location (overlapping the previous geom). Another cause can be if too many collision contacts are generated causing memory/stack issues.

Here are some things to check that you may have missed...
- Make sure all of your Space variables are global or a dim array (I can't see where you're defining the Space64 array).
- Check for memory leaks.
- Try lowering/raising the max contacts value with dContactSetMaxContacts(maxvalue) to see if that helps, its default is 128.
- Make sure your Space64 sub-spaces are not colliding with each other or the ground plane (if used).
- Make use of the body auto disable feature so that it cuts down the amount of contacts generated when objects are stationary.

I still think tiling the ODE geometry like you're doing will give you headaches, so that may be at the center of the MAV issue. Try destroying and recreating the geometry instead of repositioning, it may work better and should certainly be fast enough.

Not sure about the best way to do the shock wave, have you tried adding force to the surrounding objects based on their distance from the epicentre. Be careful changing the geom size while the simulation is running, I'm not sure how ODE will react to that. You can try using the dGeomSphereSetRadius(sphere,radius) etc functions for this purpose.

Hope this helps :)

Oh, and the forum codes...

http://www.blitzmax.com/faq/faq_entry.php?id=2