Jump to content

Why do objects blow up?


ArchTx Edo
 Share

You are about to reply to a thread that has been inactive for 4162 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

I noticed this script in the Library  http://wiki.secondlife.com/wiki/ExplodingObjects   and  had learned some years ago that sets of linked objects, if set to physical and unlinked will blow up in a fun way, scattering prims far and wide.  Some objects blow up better then others, and I would like to understand why, to optimize this phenomena. 


But even afte reading the Havok wiki page I could not find an explanation as to why objects blow up like this.   I would appreciate understanding this phenomena better.   Can anyone here explain it?

Link to comment
Share on other sites

It is a matter of a 'sudden' impact of the physics engine. And becomes stronger when the objects overlap.

What happens is this:

- The objects have been linked - means they are hold in their place / can't move
- now you make them physical, and have them overlap at their borders

- When you now unlink them, the sudden kicking in physics and their rigid body dynamics will force them to 'move away' from another. (the unlinking happens to all these objects at the same time and all of them try to get away from each other at the same time = a lot of collision effects going on)

- This force is of course stronger when the objects are overlapping and will move them with a bigger push in order to get away from the other objects nearby.

As soon as an object is physical it has 'collision'. This means: just as in real life where u can not walk through a wall they are trying to "avoid" being intermingled. But in an artificial physic environment it can happen that objects are overlapping, in this case their physical shape (rigid body) pushes them away from other physical objects in order to prevent this.

- So regarding this, to strengthen the effect you have to create an unnatural situation (the overlapping) and then release a sudden force onto them ( the unlinking - activating all objects free movement capabilities at once)

- Also the more complicated the physical shape (collision geometry = an extra mesh with the basic form to be collided with or physically interact) of an object is the wilder their behavior can be when being exposed to sudden physical forces.

They way how they will behave is completely dependent on the routines in the physics engine. (which values for certain  forces will be applied, how objects behave when being overlapping or colliding etc. ) But this kind of behavior is a generally generic way to handle objects that collide or overlap.

Some parts of of the physics in SL can be accessed with LSL scripts. (mostly used for vehicles, bullets for guns, etc)

You can i.e.. get the velocity of an object with llGetVel or even apply a physical push towards a certain direction with a certain force with llApplyImpulse. (just to name 2 examples)


An explanation about what physics engines do: 

And some more helpfull insights in how physics work in SL: 


I hope this made it better understandable for you.

Cheers, Code

Link to comment
Share on other sites

I'll expand a bit on Codewarrior's explanation. My explanation is based on what I can remember from experimenting with this years ago. Things may have changed and I may be miss-recollecting.

To make a set of physical objects explode (either on unlinking, or on rezzing of an unlinked collection), the objects must be overlapping at the moment they are rezzed or unlinked. The Havok physics engine approximates real life's distaste for having multiple objects occupying the same space at the same time, and generates collision forces between the objects until they are no longer overlapping. These forces are not perfectly elastic, as that would result in endless motion after a collision. Gravity is also at work.

If, before setting them physical, you overlap the prims of a linkset, or a collection of unlinked objects (gathered together by shift-clicking), they do not resist your efforts. Once you make them physical (and exit editing), the physics engine detects the overlap (collision) and generates the appropriate forces to rebound the objects off each other. Be careful when you set the collection or linkset physical, as exiting the edit window will start the explosion. You want to take the collection/linkset into inventory while still in edit mode.

Havok physics roughly obey the laws of conservation of momentum, so a collection of objects with different masses will result in escape velocites from the explosion that are inversely proportional to object size. Tiny things collected together with large things will fly out of the "explosion" faster than the large things.

The total energy of an objects expulsion will depend on it's mass (size) it's aggregate overlap with other objects, and their masses. Two objects that are barely overlapping will not fly away from each other as fast as two objects that are nearly completely overlapping. I don't recall what happens if two objects share exactly the same center of mass, but I'd expect Havok would generate no force between the objects as the math for computing the force vectors would contain a divide-by-zero and be discarded.

The shape of the collision surface generally follows the visible shape for basic prim objects. I don't recall how it works for sculpties and mesh and I believe it's an ovoid for avatars. If you explode a bunch of spheres, they will behave more uniformly than if you explode a bunch of cubes, just as you'd expect from RL experience.

So, if you want a violent explosion, overlap your objects into a tight little bundle. If you want only a small explosion, have less overlap. Having a few large prims in the collection will (as I recall) cause the little ones to exit at higher velocity, again depending on overlap. If you want the exploded bits to hit the ground and not roll away, make sure you don't blow up a bunch of spheres.

Good luck, have fun!

 

Link to comment
Share on other sites

Thank you both, Codewarrior and Madelaine, for such excellent explanations, I am going to have fun playing with this. 

A tip to anyone thinking of trying this. Set your objects to temporary before blowing them up, so they will delete themselves if they fly off to some far distant sims.

 

 

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 4162 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...