Search Unity

Roly poly toy physics

Discussion in 'Physics' started by Silvere69, May 10, 2019.

  1. Silvere69

    Silvere69

    Joined:
    Jul 12, 2016
    Posts:
    39
    Hello everyone,

    I search on the net and i don't find what i want...
    I want to do the same physics like a roly poly toy for a tree in my game. Like if you collide your player with a tree, the tree is puched and return to initial position if the player don't block him.

    Someone have a solution? (maybe lerp, pingpong or something)

    Thanks :)
     
  2. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,532
    The Physics term is Softbody. Most games don't use physics for that effect, it's a shader or something.
     
  3. dgoyette

    dgoyette

    Joined:
    Jul 1, 2016
    Posts:
    4,196
    You might be able to get close to the behavior you're describing using joints. It's probably a lot easier if the tree doesn't need to move around other than the rolling back and forth. A spring joint, anchored to a kinematic rigidbody, might give you the sense of something moving out of the way on collision, but trying to correct itself back to upright.
     
    racarate likes this.