Ejemplo n.º 1
0
    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;
        }
    }
Ejemplo n.º 2
0
 void Start()
 {
     cm = FindObjectOfType <cupgManager>().GetComponent <cupgManager>();
 }