- Home /
Switch off Kinematic for a Rigidbody in response to an explosion or impact?
Is there any event which fires prior to physics forces being applied so I can check their magnitude, and turn off isKinematic if I want my vehicle to get tumbled about?
Answer by Jason B · Mar 05, 2011 at 10:45 PM
As far as I know there is no such event that fires prior to a collision. I believe a collision has to actually occur before the data about it can become available. However, there is still a way to take advantage of the collision that occurs to your car while it's kinematic, and base a new physics force off of it.
Just off the top of my head, you might try testing the magnitude of the blast that hit the car's hit box, sending a signal to your car saying it just got hit (if the magnitude came back as "significant") and the magnitude of it, then turning off isKinematic and creating a new omnidirectional explosive force placed at the location of impact with the same magnitude of the one that just hit it.
Should work fine, even if it does sound a little hacky.
This seems like it would work for projectiles, but I don't see any way for a kinematic rigidbody to know it got hit with explosive force.
$$anonymous$$inematic rigidbodies still receive physics collisions so long as there is a collider component attached, the fact that they're kinematic just means that there will be no physical reaction (but the data of the collision should still be available).
But do explosions even trigger any events? They aren't collisions.
Your answer
Follow this Question
Related Questions
Projectile collides, freezes, but flips to weird angle. Help! 0 Answers
Realistic collisions with a kinematic rigidbody? 1 Answer
Moving and SweepTesting a kinematic Rigidbody multiple times within a single FixedUpdate() call 0 Answers
Preventing objects from intersecting with minimal physics 3 Answers
Disable rigidbody from being able to move other rigidbodies 1 Answer