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 ).
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 ).