Example #1
0
    public virtual void OnShipDestroy()
    {
        Rigidbody r = this.gameObject.AddComponent <Rigidbody>();

        r.drag            = 0;
        r.angularDrag     = 0;
        r.mass            = mass;
        r.isKinematic     = false;
        r.useGravity      = true;
        destroyed         = true;
        transform.parent  = null;
        r.velocity        = myShip.shipBody.velocity;
        r.angularVelocity = myShip.shipBody.angularVelocity;
        r.AddExplosionForce(myShip.shipBody.mass * (5), myShip.transform.position + myShip.GetAvg(), myShip.shipBody.mass);
    }