Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Experiments with ModifiableContactPairs, inner shape collisions

Discussion in 'Physics' started by spider-worm, Jul 13, 2022.

  1. spider-worm

    spider-worm

    Joined:
    Jun 21, 2018
    Posts:
    4
    I've figured out how to use ModifiableContactPairs to make a sphere collide with the *inside* of another larger sphere.

    https://github.com/spiderworm/unity-modifiableContactPairs-experiments

    The smaller sphere is allowed to pass through the top of the larger sphere, where it then collides with the inside of the shape.

    new.gif

    I'm interested in hearing about how I might improve this. The most interesting bit of code is here: https://github.com/spiderworm/unity-modifiableContactPairs-experiments/blob/e415f05daf2d18810fd0020657e7ac8fb4ef8ed1/Assets/Sphere Dropping Into Sphere/SphereDroppingIntoSphere.cs#L25

    My next goal is to get a small cylinder to collide with the inside of the sphere. If you have any thoughts on achieving that, I'd love to hear them.
     
    Last edited: Jul 14, 2022
    rz_0lento and Edy like this.
  2. Edy

    Edy

    Joined:
    Jun 3, 2010
    Posts:
    2,303
    Nice!
     
  3. spider-worm

    spider-worm

    Joined:
    Jun 21, 2018
    Posts:
    4
    Thanks!

    (Edit: I got the gif uploaded successfully)
     
    Last edited: Jul 14, 2022
  4. spider-worm

    spider-worm

    Joined:
    Jun 21, 2018
    Posts:
    4
    Edy likes this.
  5. Edy

    Edy

    Joined:
    Jun 3, 2010
    Posts:
    2,303
    Wouldn't work changing the small sphere with a cylinder in the first example? Just thinking loud, but if I've understood it correctly the contacts are modified based on the "modified" shape.