A place to discuss everything related to Newton Dynamics.
Moderators: Sascha Willems, walaber
by agi_shi » Sun Aug 30, 2009 4:38 pm
Hi. I used the SceneCollision functionality to create a scene of many static boxes which a "grouped together". When I drop many spheres on this SceneCollision, everything works 100%. However, if I drop boxes on the same SceneCollision, I get a hard crash that I cannot trace to anything. If I replace the SceneCollision functionality with the same exact setup via a CompoundCollision, the crash disappears - both boxes and spheres work 100%. Here is my code:
- Code: Select all
// scene collision approach
// NewtonCollision *sceneCol = NewtonCreateSceneCollision(phys::world, 0);
// compound collision approach
std::vector<NewtonCollision*> parts;
BOOST_FOREACH(const entityPtr &ent, ents)
{
mat4 mat(mat4::IDENTITY);
mat.makeTransform(ent->pos(), vec3(1, 1, 1), ent->rot());
float matf[16];
convertMat4(mat, matf);
// compound collision
parts.push_back(NewtonCreateConvexHullModifier(phys::world, ent->collision(), 0));
NewtonConvexHullModifierSetMatrix(parts.back(), matf);
// scene collision
// NewtonSceneProxy *proxy = NewtonSceneCollisionCreateProxy(sceneCol, ent->collision());
// NewtonSceneProxySetMatrix(proxy, matf);
}
// scene collision
// NewtonSceneCollisionOptimize(sceneCol);
// compound collision
NewtonCollision *sceneCol = NewtonCreateCompoundCollision(phys::world, parts.size(), &parts[0], 0);
collision(sceneCol); // simply calls NewtonBodySetCollision()
NewtonReleaseCollision(phys::world, sceneCol);
This happens with the latest windows build, regardless of the amount of threads.
-
agi_shi
-
- Posts: 263
- Joined: Fri Aug 17, 2007 6:54 pm
by agi_shi » Sun Aug 30, 2009 4:45 pm
Here's a demo that shows the crash. Just run bin/win/release/demo_low_gfx (or run the main exe if you have a powerful GPU), use WASD to move around and press SPACE to spawn a bunch of boxes, which will shortly cause the crash:
http://filesmelt.com/downloader/c4v3rnz_test_build.zip
-
agi_shi
-
- Posts: 263
- Joined: Fri Aug 17, 2007 6:54 pm
by Julio Jerez » Sun Aug 30, 2009 5:47 pm
Ha good that people start experimenting with scene collision.
I got demo demo, and I get the crash.
I see a level that resembles a pool table with a ball that I can spin around.
when I hit space I get the boxes and the game crash.
what geometry is the Scene collision? it is the Floors an dteh borders or what?
-
Julio Jerez
- Moderator

-
- Posts: 12426
- Joined: Sun Sep 14, 2003 2:18 pm
- Location: Los Angeles
-
by Julio Jerez » Sun Aug 30, 2009 7:35 pm
I found the Bug the scene collision was not clamping the max contact count, and soem tiem teh bux land in an area with tah overlap lot of thoses boxes.
This generat a very lorge number of contact that nee to be discimunated, to ge onle teh essicail for good collision respondod.
All other pair collider have tha function at teh end but I forgot to added to teh Scene/oeh shape colliders.
It is fix now but I go the engione is a state of flux until I get this new feature I am working on now.
you will get the fix with next beta build.
what are you doing that you need to get some many intersecting shapes at amost the same location?
I kind of cool seeing the glow effect and the ball trying to navagate over the obstacles.
If you need a dll send me a PM.
-
Julio Jerez
- Moderator

-
- Posts: 12426
- Joined: Sun Sep 14, 2003 2:18 pm
- Location: Los Angeles
-
by agi_shi » Sun Aug 30, 2009 7:42 pm
Cool, thanks

I'm making a tile-based level system with level files such as the following:
- Code: Select all
#################
#-----------SSSS#
#-----------SSSS#
#-----------SSSS#
#-----------SSSS#
#---------------#
#---------------#
#---------------#
#---------------#
#---------------#
#---------------#
#---------------#
#--P------------#
#---------------#
#################
Basically, every '-' is a floor and every '#' is a wall. The other pieces are mostly dynamic game-play pieces. Therefore, instead of having N amount of separate bodies for every tile, I figured I could put all of the static pieces (wall/floor) into a SceneCollision

The speedup was definitely noticeable over using separate bodies. However I did get that crash, so I switched to using a CompoundCollision for now (which is a bit slower, but it's an acceptable fix for the moment). If I had the time, I would've made a more optimized level loader that combined adjacent pieces, however, I only have about 3 hours left

- I'm competing in the ludumdare 48h #15 competition

-
agi_shi
-
- Posts: 263
- Joined: Fri Aug 17, 2007 6:54 pm
by Julio Jerez » Sun Aug 30, 2009 8:08 pm
agi_shi wrote:...., I only have about 3 hours left

- I'm competing in the ludumdare 48h #15 competition

Wow, oh Man you are crazy, you are compiting and at the same time findng Bugs. What esle is New.
Good luck in the context.
-
Julio Jerez
- Moderator

-
- Posts: 12426
- Joined: Sun Sep 14, 2003 2:18 pm
- Location: Los Angeles
-
Return to General Discussion
Who is online
Users browsing this forum: No registered users and 9 guests