Search Unity

Figuring out physics

Discussion in 'Physics' started by BenVenNL, Oct 17, 2019.

  1. BenVenNL

    BenVenNL

    Joined:
    Oct 14, 2019
    Posts:
    56
    I'm new at this so maybe I'm asking stupid questions.
    Just seeing if my idea's can be implemented.

    A simple case.
    Sphere object 1 (SO1) is not moving. Sphere object 2 (SO2) is hitting (SO1) at a velocity.
    Depending on mass and speed these two react to each other.

    But I find that objects react like 'biljard balls' 1 frame of impact between the two and SO1 shoots away.

    Can these objects act more like a 'biljard ball' is hitting a 'softball'. In that case the two objects will have multiple frames of contact (SO1 is absorbing some of the energy) and then it flies off somewhere.

    If thinking of a game of simply letting prefabs consisting of several simple object crash into each other. But with a few stages of destruction adding to it. The longer the contact between these objects, the more energie is absorbed, more stages of the destruction animation will be shown.

    How does this work, is this feasible.

    Thnx for the support.
     
  2. Edy

    Edy

    Joined:
    Jun 3, 2010
    Posts:
    2,510
  3. BenVenNL

    BenVenNL

    Joined:
    Oct 14, 2019
    Posts:
    56
    The Visual Studio download is not ready yet, but as soon as it is i'll start doing some testing by changing the color of my object when in contact with another. Already looked for some code and it seems te be out there.

    Yes, I fiddled around with the 'bounciness' and have an idea how it works. And I also read the topic you mentioned.

    Simplified, from what I've seen.
    I think the 'bounciness' affects the time at wich velocity is reversed and what is left of its original velocity. A hard object will bounce off in 1 frame losing 75% of its velocity in reversed direction.
    A bouncier object will 'slow down', ' get to a complete stop' then 'speed up in reversed direction' only losing 90% of it's velocity, then 'fly off inreversed direction'. It mimics the reaction af a rubber object shrinking and expaning on impact absorbing the energy and releasing it again. While not really animating the shrinking and expanding of the object it self.

    Is this whole process of 'bouncing' calculated on impact or is this something that is done for a few frames/miliseconds in a row?

    If this the latter the case, what wil happen when half way through the process of 'slowing down-stop-reversed speed up' the object (SO1) is destroyed/removed/deleted from the scene? Will SO2 move at reduced speed in it's original direction? In other words, it's only slowed down and did not have the time to completely bounce back..

    Please say yes and I will get very exited!:D
     
  4. Edy

    Edy

    Joined:
    Jun 3, 2010
    Posts:
    2,510
    As far as I know the whole process of bouncing is processed in a single physics step. As said, collisions in Unity physics are inelastic, so there's no slow-down process and such.

    EDIT: The guys in other thread I mentioned figured out a workaround using a hidden box with a spring joint.