Sphere, internal collision

I’ll preface this by saying I’m a Unity scrub but have decent game programming experience, particularly XNA, GameMaker, and Processing.

I’m working on a game that does something like MonkeyBall where a primary ball is the player except it uses multiple objects in the sphere to determine it’s movement.

I’m trying to find a to keep the objects the sphere. I made the meshes in Modo, an internal and external sphere. The internal sphere has the normals flipped to face the center of the sphere.

I tried to use a Mesh Collider but received a “Non-convex MeshColliders with non-kinematic Rigidbodies are no longer supported Unity 5.0.” error. I’m not entirely sure what this means. This suggested turning on the convex and trigger fields but that just gave me more errors complaining about the amount of polys my mesh. I’m not sure if I can actually reduce the polys since it is the basic sphere Modo.

Another post I read suggested using the Vector3.Reflect to keep the objects when hitting the outer of the sphere. This be my option but I’m not entirely how I would implement it considering my lack of Unity experience.

I would appreciate any suggestions or pointers.

!

The issue with non-convex colliders with rigidbodies is a drawback to the physics engine. You only really run into it when you’re trying to do things that essentially boild down to “hamster wheels” - all physics objects needs to be convex - which means that there has to be a closed surface in every outward direction.

I think that the best solution would be to not use physics on whatever’s inside the ball. Put an animated character there, and play running animations, but instead of moving that character and having physics make the ball roll, just roll the ball by using rigidbody.AddForceAtPoint at some appropriate point along the sphere… Not only will that fix your problem, it’ll probably be a lot easier to tune than having things work with a character inside.

Edit: you should also experiment with AddTorque or AddRelativeTorque, depending on your need. Keep the model in the center of the ball in place by setting it as a child of the ball, and then setting it’s local rotation to the correct value every frame.