Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question physics question about springy cushions and vertices!

Discussion in 'Physics' started by itisemtea, Oct 3, 2023.

  1. itisemtea

    itisemtea

    Joined:
    Mar 29, 2020
    Posts:
    15
    hi! i have these cloud objects that the player can come into contact with and currently they are rock hard like they are made out of stone, and i would like them to be soft and cushiony, like a cloud! my idea is that the vertices could bend in slightly and slow the player's movement incrementally until stopping? and then return to position after the player leaves! i was wondering if anyone had any ideas or simple solutions that don't require too much programming because i'm a novice. thank you for any help! <3 image_2023-10-03_093237226.png
     

    Attached Files:

  2. Edy

    Edy

    Joined:
    Jun 3, 2010
    Posts:
    2,477
    Most likely that can be done with the contact modification event:

    https://docs.unity3d.com/ScriptReference/Physics.ContactModifyEvent.html

    In summary, you subscribe to an event that is invoked for each contact pair in collisions. You can then modify the results of that collision by modifying the corresponding ModifiableContactPair.

    I don't know the exact way to modify the contact pairs to produce the expected results, but I'm pretty sure that if there's a way to do it, it is using this method.

    EDIT: There's some discussion and examples on this in this forum thread.