PDA

View Full Version : Explosions with DMM?



GRAuM
10-08-2009, 04:44 AM
Hi there.

Im testing DMM with the evaluation kit and have some Questions. At the moment im trying to generate something like a FireBall. If it hits it should generate a big explosion. But i dount have an idea how to do the explosion it self. I found a tutorial that explains maya forces. But im not an artist and i dount have Maya. So i wonder if there is a way to do this just by code. Im shure there must be a way... but how? How can i generate a force field to simulate a explosions shokwave? :?: :?: :?:

DrDMM
10-14-2009, 09:30 AM
Hi GRAuM,

The way to do it is to use either Node::AddForce or Object::AddNodesForce, with the later being a single call for multiple nodes of an object. I'm attaching a force manager we use for internal testing that isn't quite as optimal as it could be, but should be a decent starting point to play with.

The way it's invoked is to add the objects you want affected by the explosion to the manager, and then make the following call:


// 20 atmosphere pressure at 1 meter radius, centered at pos
forceManager->explode(pos, 101325 * 20 * 30, 4.0f/60.0f);


That's assuming your units are kg and meters.

In a production environment, in order to save memory, you might very well set the OBJECT_FIXED_ONLY bit and/or the OBJECT_DISABLED_BIT on objects. You'll want to get in the habit of not calling things like AddForce on those objects if you think you might get to the point of using those types of objects.