About Store Forum Documentation Contact



Post Reply 
destructibles
Author Message
rndbit Offline
Member

Post: #1
destructibles
I noticed few weird things.

Destructibles are destroyed when they are created
Look at this image
http://pastebox.it/get/img/105bcfa2f0888...hot_2.png/
Right from head you can see a cut-line, parts come just a little bit apart. Wall was not touched, is how it spawned.

Broken walls bahave odd
Picture is worth a thousand words (and almost 10MB): http://rndbit.net/destructible.avi
You can see that wall breaks apart fairly easily, however parts seem to be locked together with like with a rubber band. Should not they just come apart when they come apart?


Also, can we somehow make destructible objects harder to break? At the moment simple touch makes them break, but in reality one would wish a solid wall or floor that could be walked and jumped upon, and the object could be broken only with some heavy firepower like exploding barrels or what not..
11-10-2011 07:02 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #2
RE: destructibles
Hi,

You have sources for destructible objects included in the Personal license.

You can adjust them to your own needs.

For example: customize joint strength.
11-11-2011 07:37 PM
Find all posts by this user Quote this message in a reply
rndbit Offline
Member

Post: #3
RE: destructibles
so as i understand breakables are intended to spawn broken as they are kept together by joints. i was expecting object to be as a whole at first and be replaced with broken parts after the impact.

Edit:
After some tinkering we could get some of desired effects:
1. Destructible objects are spawned as static and only after collision they are changed to destructibles. That is to be changed so upon spawning objects could be dynamic and after certain amount of force is applied they would turn into destructibles.
2. More realistic destruction (no rubber walls).

This realistic destruction is achieved by lowering max allowed torque for breakable joints, however then simple touch makes wall fall to the pieces. still not very realistic.

Anyhow im pretty sure this can be programmed so it looked realistic. Maybe having joints respawn X times after breaking - it would require X * max_allowed_torque to break wall completely, but would prevent wall breaking instantly.
(This post was last modified: 11-12-2011 12:11 PM by rndbit.)
11-12-2011 10:45 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #4
RE: destructibles
Quote:so as i understand breakables are intended to spawn broken as they are kept together by joints. i was expecting object to be as a whole at first and be replaced with broken parts after the impact.

you can control default mode here:
#define DEFAULT_MODE BREAKABLE // here you can specify the default mode for Destructible objects - STATIC or BREAKABLE

STATIC is 1 actor
however it does not detect automatic breaking into pieces, only manual (you can check 'update' method to see detection of collision/breaking)
11-15-2011 08:58 PM
Find all posts by this user Quote this message in a reply
rndbit Offline
Member

Post: #5
RE: destructibles
exactly what we are trying to do ^_^ we actually extended class so object was dynamic and upon collision it would break into pieces. looks pretty good except for the fact that it requires zero impact force to break the object.

i am yet to figure out how to detect collision force. was thinking of checking speed on each frame. rapid change in speed would mean object received amount of force that made it to move - therefore the difference between speeds would be impact force. i am yet to test it tho.

Besides - destructibles are really amazing feature! I bet with some time and dedication it is already possible to make quite realisticly destructible objects. I am day-dreaming about dynamic slicing of meshes actually. Anyhow great job on those smile
11-16-2011 09:58 AM
Find all posts by this user Quote this message in a reply
rndbit Offline
Member

Post: #6
RE: destructibles
thanks for detectiong collisions, that allows pretty sweet destructibles i would say, but there are some weird issues i cant yet figure out.

1. Broken parts often fall through terrain ( even with ccd(true) )
2. Broken parts often take pretty long to come to a rest - they just jump around.

I guess picture is worth a thousand words so there is a demo movie:
http://rndbit.net/test/1.htm

Anyone has any ideas how to tackle those two problems?
12-07-2011 02:27 PM
Find all posts by this user Quote this message in a reply
fatcoder Offline
Member

Post: #7
RE: destructibles
Is that your normal frame rate in the video or is it just really slow because you were recording it?

Physics simulations are very sensitive to the time step. If that is your normal frame rate then I'm not surprise you are getting strange behaviour.
12-08-2011 01:39 AM
Find all posts by this user Quote this message in a reply
Driklyn Offline
Member

Post: #8
RE: destructibles
The pieces are jumping around because their mass is set too high. Adjust them so they're lower and the bouncing should stop. This should also prevent them from falling through the ground, as well.

For instance, if you add this code in the appropriate spots to your game or in some tutorial project (e.g. Code Editor's "EsenthelEngineSDK/Tutorials - Esenthel Script/Loading World" project), you'll see the bouncing effect:

Code:
Mesh  mesh;
Actor actor;

bool Init()
{
   Box box(0.1f);

   mesh.setBase().parts.New().base.create(box, VTX_TEX0 | VTX_NRM);
   mesh.setNormals().setAutoTanBin();
   mesh.setRender().setBox();

   actor.create(box, 1).mass(1).ccd(true).pos(Vec(5));

   // ...
}

void Render()
{
   Game.World.draw();
  
   switch(Renderer())
   {
      case RM_PREPARE:
      {
         mesh.draw(actor.matrix());
      } break;
   }
}

However, if you change the mass from 1 to 0.1f, the bouncing stops.

Also, turning off ccd with a mass of 1, in this example, will cause the actor to fall through the ground. Keeping ccd on seems to prevent the actor from falling through the ground regardless of its mass (I set it to 1000, still doesn't fall through but it bounces a bit).

That being said, this does not seem to be the case with destructible objects. I was still able to get actors to fall through the ground even with ccd turned on (as you said) by setting the mass high. Why this is the case, I do not know...
12-08-2011 04:48 AM
Find all posts by this user Quote this message in a reply
rndbit Offline
Member

Post: #9
RE: destructibles
@fatcoder: yes, framerate is normal, just in the video its somewhat slow, i guess its just how instantdemo records things.

@Driklyn: hmmm i lowered mass for the object to 0.1 and to the parts to 0.02, turned iff ccd.. Now what happens is that table does freeze in the middle of air after a bit of time when moved. As if game was paused when table was moving smile) Trich helped to remove abnormalities for bigger parts of the table when broken - they behave now how they should, however smaller parts just fall through terrain. Turning back ccd for broken parts makes them jitter again. Ill see what i can do little bit later again.
12-08-2011 10:49 AM
Find all posts by this user Quote this message in a reply
Post Reply