void Start() { cm = FindObjectOfType <cupgManager>().GetComponent <cupgManager>(); rb = gameObject.AddComponent <Rigidbody>(); rb.useGravity = false; rb.mass = mass; rb.SetDensity(density); rb.collisionDetectionMode = CollisionDetectionMode.ContinuousDynamic; rb.AddForce(InitForce * cm.gravity); if (this.GetComponent <Collider>() != null) { PhysicMaterial pm = new PhysicMaterial(); pm.bounciness = bounciness; pm.staticFriction = staticFriction; gameObject.GetComponent <Collider>().material = pm; } }
void Start() { cm = FindObjectOfType <cupgManager>().GetComponent <cupgManager>(); }