Object destruction


#1

Hello, can i destroy object (egg or bam format) in panda3D ?
like this video :

this is “fake” destruction (annimation create in blender)
or real destruction (cut object by physic engine in real time)

can i cut object in panda3d ?


#2

For that video I first made the box, then cut it up into pieces using the modeling software, each part was exported as a separate object with its own collision solid (actually I later made the collision solids out of boxes made in the script, not polygons, to get some extra speed). When the box is exploded I remove it from the scene and in its place I put all the fragment models, finally I apply a force impulse to each part and let Bullet Physics do the simulation.
So in other words - the ‘breaking apart’ is pre-made and the ‘thrown in the air and fall dawn’ part is simulated in real-time.
I should still have the code and models I used in the video, so if you’re really interested I can share that.


#3

thank you for your answer
Yes, I’m interested if you could share the code.

but I would like to know if it is possible in panda3d to “cut” an object (egg or bam) ?
it could easily generate impacts for example (we would make a hole in the object)

i search solution that like this :
https://www.panda3d.org/manual/index.php/Sample_Programs:_Looking_and_Gripping

but i don’t foun how create my custom Joints directly in code
(add joint in actor.listJoints())

and i can not found solution for cut out the head in example (i can only apply rotation)


#4

I’ll post the code tomorrow, when I’ll get my hands on the pc where I got the code.

Cutting an object into pieces can be done in code, but it’s not that simple. Where do you want to cut the object - using existing polygons or cutting the polygons and defining new ones? 3D models are usually empty shells, if you cut a head of a model you will be able to look inside - and see nothing because of backface culling in most cases. You could extrude the polygons inside using the normal vector, but that won’t work in all cases, the ‘inside’ polygons will often poke out of the ‘outside’ polygons. You could cap the gap but how to texture that?
Even if you solve all these problems it may turn out that changing or generating new geometry on the fly will result in a big fps spike (drop). Making a cut version of the mesh you want to cut is really the best way in my opinion.


#5

I just want to cut the object.
I just don’t want to have a new texture!
I would like to be able to simulate a hole in a wall, for example like this :

i only want to remove polygons, textures, and physic collision directly in the code
not recreate texture or polygon

do you have any idea how to delete polygons in an object in panda3d? and is it possible to update the physics (with bullet) of this object?


#6

Cutting a hole in a wall may be a bit more complex then you think. Here’s an example made in a 3d modelling package:

Your code would have to take a mesh like the top one and produce a mesh like the bottom one. I’m not saying it can’t be done - I’m just saying it ain’t that simple.

Anyway, here’s the code and models I used for recording that video from the first post:
boom.zip (649.0 KB)
Code is Public Domain/CC0, models/textures CC-BY-SA


#7

thanks for sharing your code