I am trying to set up a bounds for a sphere made using gameObject to use to detect when the sphere intersects the ground. This is what my code looks like so far
public class Particle{
public GameObject sphere;
public Bounds sphereBound;
}
Particle aSphere = new Particle();
aSphere.sphere = GameObject.CreatePrimitive(PrimitiveType.Sphere);
float radius = Random.Range (0f, 0.5f);
aSphere.sphere.transform.localScale = new Vector3 (radius, radius, radius);
aSphere.sphere.transform.position = new Vector3 (0f, 10.0f, 0f);
aSphere.sphereBound = new Bounds (aSphere.sphere.transform.position, aSphere.sphere.transform.localScale);
aSphere.sphere.transform.parent = transform;
Is this the right way of adding Bounds to my sphere or is there something I’m missing? Also, this is a project in which I have to figure out the collision detection myself instead of using the classes in Unity so I am not allowed to use the Rigidbody or Collision class.