Hello,
I have a Large Sphere with the normals flipped and inside of that sphere are a bunch of smaller ones that are bouncing around. I cant seem to figure out how to keep the smaller ones inside of the Large Sphere. There is always one or 2 of them that pop out?
I’ve attached 2 images so you can see the colliders I have attached and the rigidbody in the hopes of getting some help.
Also I have a script attached to the smaller balls:
var gravity = 1;
function FixedUpdate ()
{
rigidbody.AddForce(-Vector3.up * rigidbody.mass * gravity);
}
and a Force script attached to an empty game object under the Large Sphere:
var radius = 1;
var power = 20.0;
function FixedUpdate ()
{
// Applies an explosion force to all nearby rigidbodies
var explosionPos : Vector3 = transform.position;
var colliders : Collider[] = Physics.OverlapSphere (explosionPos, radius);
for (var hit : Collider in colliders)
{
if (!hit)
continue;
if (hit.rigidbody)
hit.rigidbody.AddExplosionForce(power, explosionPos, radius, 3.0);
}
}
As you can see there is not a lot of force or anything going on but I still cant figure out the right combination to keep the smaller balls inside of the larger sphere without one or two popping out?
Anyone have any ideas? or suggestions on how I might change the Large Sphere or Smaller ones so that none of them pop out?