Experiments with ModifiableContactPairs, inner shape collisions

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.

8273133--1084569--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.

2 Likes

Nice!

Thanks!

(Edit: I got the gif uploaded successfully)

Now I have boxes that have configurable interior cylindrical colliders.

8279877--1085121--InnerCylindricalCollider.gif

Relevant C#: unity-modifiableContactPairs-experiments/Assets/CurvedInteriorCube/InnerCylindricalCollider.cs at main · spiderworm/unity-modifiableContactPairs-experiments · GitHub

Right now only radius 1 spheres collide correctly with this. Next step: get other shapes to collide correctly.

1 Like

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.