Search Unity

Calculate hit force

Discussion in 'Physics' started by Borhink, Aug 16, 2019.

  1. Borhink

    Borhink

    Joined:
    Aug 6, 2019
    Posts:
    3
    Hi,

    I'm in a front of a math problem !
    I dont know how to name what I am searching for... Force, Impact ?
    It's easier to explain with an image.
    We have two gameobject with collider, A and B. They can move in any direction (top down game with 360° movement possibilities).
    First case (left): A go to the right at a speed of 2, B to the left at a speed of 1 and they collide. How to calculate that A take 1 damage (from the speed of B in its direction) and B take 2.
    Second case: A go to the right at speed of 2 and B to the right at speed of 1. A take 0 damage and B take 1.


    collisions.png

    I have no idea how to calculate thing like this, because the directions can have an angle of 0, 15, 22, 112 or any other of the 360 possibilities...

    Thank !