How to manually check colision [SOLVED]

Just normal RigidBodies, I suppose you want your fragments to fly around, no?

Not exactly, a bit of they will, but mostly will stay just in memory.
I was in hope I dont need to input any of this objects in the scene or in the physical world, since they are many. I just need a very fast way to do it, will it be the way ?

I’m afraid I don’t get what you want to do then. Why do you want pieces at all if they are neither rendered nor physically interact? If at all you get more overhead from the physics if you check them all separately instead of letting the physics space do that. You could also make a separate physics space if you don’t want the pieces to interact with the other physics space.

Simulate fracture. I will keep the original object that must probally will not fracture completly, some part of ( some peaces) it will fly, but not all of they.
I was planning to do in the collide event :

  1. create an explosion sphere and check all peace memory objects it collide.
  2. create some peace objects and apply to the scene.
  3. change the mesh of the original object ( removing the parts ).
  4. remove the flying peaces from the memory array.
    I saw another post here in the forum about one guy that did something close to it, I will look on that too, but also what I want is to use the fracture models I have made in blender, it has good fracture generators and it imports fine in Jm3.

I just don’t get why you want pieces that you won’t use in the end in the first place.

I will use, all peaces that get hit by the explosion will be used in the scene.
But not all of they will be used.
Found the topic : Destruction of walls - #24 by tonihele
He was doing something similar, if you look at some pictures you will see a house, there is peaces on all walls, but you will not trow peaces from all walls in the air if the cannon hits only one wall right ?

?? All will be used but not all will be used?

What the guy was doing is separating the wall that was hit into pieces (and only that one) in the moment it was hit (and only in that moment). He didn’t keep all pieces in memory before the wall was hit, he added them in that moment.

I am doing exactly the same.
I think you may confused me on how I am keeping it in memory.
I am just keeping the geoms in one array, its not linked in the scene, I think its the best way dont ?
I could store in the array just the vertices maybe…
I guess he was also doing the same technique, since he needs to load the peaces somewhere.
Its a shame its an old topic, do you know if he posted the source anywhere ?

But he knows where to put the pieces when one bigger part disintegrates. Simply because theres basically two versions of each object, one geometry of the whole object and one Node with all the single pieces as Geometries in the right location. He didn’t try and solve a puzzle of “how can I make this big object from all the small pieces I have”.

I also have the big object version and the peaces all toguether version, preaty much the same, actually that is the way blender generates this.
But, I dont know if he create the objects and put physics on all these objects in the scene, in my case I am not doing that because I figure out it has much more performance if I just get it into one memory array and keep it there to use only in one colision event.
In one performance test, I was getting arround 60 fps with all objects and peaces added to the scene and physics, even if I just add this objects to ghosts I was getting arround 90 fps.
With out those peace objects, I am getting 300 fps, so the diference is big.
I dont know about this colision computation I am planning to do thought… I maybe inviable, maybe not, just need to test it.

Again, you put the pieces and physics for them in the scene in the moment the wall explodes. Not before.

Yes, thats it. I guess in the moment of the collision, he just remove the whole object and replace it by the peaces object… I dont know, I could do it, but I would like to test it doing in parts, changing the meshes, if I could find a fast way to do the collision calculations, it will be less objects in the scene.
I was planning to do a spaceship mining game, where the ship just shoot and explode asteroids in small peaces, since this ship can shoot multiple asteroids at the same time, it will fill the scene with geoms very fast…

For better understanding of the problem, imagine an space mining game scenario where the player needs to mine an very big rock shotting lasers on it.
When the lasers hit the rock, it will break a small part of the rock in some peaces, the player needs then to collect this peaces.
Now, if the rock is big, it will have thousands of peaces inside, if I put all this it in the scene it will be very performance consuming.
That is why I am looking to a way to do fast colisions check in memory.

A collision check is a collision check, it always happens in memory.

That is true. Maybe if I just create ghosts for this objects and create an control for the peaces it will fix my probem… Is the ghost approuch the fast way to do colision in jm3 ?

Just do what normen says. I have yet to see someone doing something else for what you want to do.
You are doing that with asteroids and I’m doing that with body parts… It’s the same.

Just replace your model by the model of its body parts and apply a force to them.

EDIT: Ohhh … maybe I understand you … You plan to make your asteroid broken pieces asteroid themselves ? So 1 asteroid could lead to 4 debri
s which could lead to 16 debris an so on, and you fear that it’s going to fill your scene graph ? Just reduce the number of broken pieces by some kind of inverse function of the size of the asteroid ! This way the small ones will stop making debris, breaking the chain reaction :slight_smile:

I think you might not be aware that ghost object collisions always happen with the bounding box of the ghost object. Just add the pieces with RigidBodies when the wall is supposed to explode.

I cant just replace it, imagine one big asteroid with 10000 peaces inside, if I just swap one geom to 10000 smalll geons it will break the scene. Dosent mather if they will be in collate state.

Will try that !

You won’t get anything near 10000 pieces anyway (note: if you didn’t see it in an AAA game yet its not because their programmers are too stupid). Make a few big pieces and do the rest with particle effects.