SceneCollision and Roaming worlds

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

SceneCollision and Roaming worlds

Postby Spek » Sat May 09, 2015 3:26 am

I figured a new topic would cover the matter better, but a bit in relation to the previous "Advanced worlds" questions: How 'bout "Roaming" & SceneCollision?

If I get it right, you'll:
1- create a collision
2- add X sub-collisions
3- finish the sceneCollision
4- create a body & set that sceneCollision
5- destroy the sceneCollision

Tried it, and it works. But how to deal with a roaming situation? In my game, sub-parts of the map are dropped and added as you go. Can I just get the collision from the sceneBody, and start adding/removing again? And do I have to call "NewtonBodySetCollision" again?

Or do I'll have to rebuild the whole collisionScene? In that case, I imagine this is a pretty heavy operation. Is it possible to do this silently in a background thread?



As for destroying collisions after attaching them to a body, why is that btw? I would say you would want to keep a collision, so you can re-use it for other bodies. for example, if I have 100 rocks with the exact same convex hull, does each body have its own point cloud, since I can't keep a collision and use it for another body?
Spek
 
Posts: 66
Joined: Sat Oct 04, 2008 8:54 am

Re: SceneCollision and Roaming worlds

Postby Julio Jerez » Sat May 09, 2015 8:58 am

you do it like this
Code: Select all
        sceneCollision = NewtonBodyGetCollision(body)
   // start adding shapes to this scene collisions
   NewtonSceneCollisionBeginAddRemove (sceneCollision);

//add or remove, or change location of any child nody
   // finalize adding shapes to this scene collisions
   NewtonSceneCollisionEndAddRemove (sceneCollision);
Julio Jerez
Moderator
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 5 guests

cron