Open tristanbob opened 2 years ago
This excellent article talks about the ways to use physics to make a platformer game. https://bhopkins.net/pages/mmphysics/
The section on "Crushing Force" is relevant to the proposed feature described in this issue..
In Box2D's PostSolve for collisions, we can access the contact impulse.
This can be used to determine how much force is being applied to our
character and if they should take damage from being crushed.
Each frame, all impulses are added together and tracked over time.
This is important because a collision might apply its force over multiple
frames depending on exactly how the objects collide.
Description
In a physics game, you might want to apply damage, points, or sound and visual effects based on the force of the impact.
The speed of the impact should be made available to the user in an expression and condition.
Solution suggested
Reference: https://2dengine.com/?p=box2d#What_is_the_relative_velocity_at_the_moment_of_collision