They will all explode!

28_aa_cu2
argon-assault
3d

#1

Hello!

This is my first post here :). Hello all! I’ve been going through the Udemy lectures one by one. Just now I stopped and I’m sharing my first video of Argon Assult. Didn’t go off the track much, but added a few bits and pices here and there (like rocket falling down after death :slight_smile: ).


#2

That’s cool how the rockets spins and falls after the death. How did you end up doing that? Or is that something we learn later in the lecture?


#3

Wow! Somebody did look at my post :slight_smile:

From what I remember it isn’t covered in the course. That effect is very easy to accomplish. Basically you enable gravity and kick the ship ;-). Technically in CollisionHandler I’ve added FallDown() method, which is called from StartDeathSequence() that looks like that:

    private void FallDown()
    {
        Rigidbody rb = GetComponent<Rigidbody>();
        rb.useGravity = true;
        rb.AddForce(Vector3.down * 100, ForceMode.Impulse); // TODO extract for customization
        rb.AddForce(Vector3.forward * 50, ForceMode.Impulse);
        Collider[] colliders = GetComponentsInChildren<Collider>();
        foreach (Collider c in colliders)
        {
            c.isTrigger = false;
        }
    }

(now that I see it I should have do the math and and call AddForce just once. Probably it was late at night when I was coding :wink: ).