Distort a mesh on collision

Hello,
Is there a way to implement mesh distortion on collision like in this little animation
https://playground.babylonjs.com/#NSAKWZ
(this animation is only for an illustration of what I try to do, in this animation meshes are cubes, so they have not enought vertices to implement a realistic deformation)

I thought a bit about it and it seems not so easy

  • you have to implement energy absorbtion (deformation absorbs energy)
  • the amount of deformation depends on the bodies speed, hardness, …
  • and certainly a lot of othe constraints

Hi Djousto… good to see you again! You finally arrived at the new forum. :slight_smile:

Hey, I think you may be describing physics “soft-bodies”.

https://doc.babylonjs.com/how_to/soft_bodies

It’s advanced physics, which means I’m clueless… but… hmm. There may be an “elasticity” value on soft-body physics… that determines “how much tendency to revert-to original shape after being smashed”. :slight_smile:

In other words, a soft body might be able to “freeze” in “smashed mode”. Not sure.

Maybe worth some experiments… and some deep web-reading about Ammo/Bullet-brand physics engines… soft-bodies division.

2 Likes

thank you Wingnut, i’m happy you remember me, I did not visit this forum since many months (perhaps years). And effectively soft-bodies seems to be what i’m looking for, i’ll try to play with this and post results if they are worth.

1 Like

Cool. Share your soft-body discoveries/playgrounds/knowledge with us, ok? (why does that sound somehow perverted? Sorry.) heh

Soft-bodies (the physics-engine kind) are new stuff… for most of us… thx to AmmoJS/BJS plugin.

I like that playground you made… shadows… good physics “catapulting”… it has a “jumping monster truck tire… colliding-against an econo-line van/combi… feel”, eh? nod. :slight_smile: Nice. Crushing things is FUN! (Anyone used BeamNG.drive? That’s a mesh-bender… needs lots of CPU power, me thinks.)

I want to give a shout-out to ALL the people who worked-on the AmmoJS plugin/impostors, and for some darned fine introductory and intermediate-level docs, too. Thanks to the AmmoJS team, we have MOST of AmmoJS power… within reach of BJS scene objects.

Now if we could JUST connect a 4 million horsepower Cray engine… to our JS… that’d be something. :slight_smile: Maybe next-gen.

here is an attempt to do a basic deformation after collision
https://playground.babylonjs.com/#RGNDK2
next step is to detect the vertices that collided so I can limit the deformation to the collision area

1 Like