Havok: bullet vs window (or so) possible?

Hi everyone,

Trying to: Bullet breaks window and continues on trajectory.

I thought maybe the “ANIMATED” motion type could work but it just freezes the bullet.

I also tried restitution=0, mass=0 for the bullet, all permutations of the motion types. No success. I also read that Havok uses some sort of a “continuous” or so approach. So I think you cannot just set a very high velocity to clip the bullet through the obstacle.

Anyway, hoping for a simple solution by nulling a havok parameter or so :face_with_peeking_eye:

Here is a playground: https://playground.babylonjs.com/#7JI3E8#6

Best wishes
Joe

//edit: Workaround 1: Bullet is massive enough and kicks window out of the way. Code is super simple. But drawbacks are a) window must be DYNAMIC b) window is either broken or not (1st bullet makes collider fly off!). https://playground.babylonjs.com/#7JI3E8#8

Hello!

To move the ANIMATED body, it seems you have to set its velocity directly, impulse won’t work as it’s applying a force: Physics V2 collision callback | Babylon.js Playground (babylonjs.com)

3 Likes

Yes! Nice. Thank you @carolhmj :slightly_smiling_face:

Rather than rely on a physics event to break the window (which seems to be too late, because it’s already “bounced off”), could you split the problem in two: keep the bullet as a simple DYNAMIC object, and do a raycast yourself to smash the window? Or even, just smash the window on a timer?

I thought about that, too. But you need to know when the bullet collides with obstacles. So eventually you end up re-inventing half of the collision system :open_mouth: I wanted to avoid that if possible.

1 Like

Please note: requires the latest version of Babylon!