Randomized crate explosion

Noticed the explosion of the crate was kind of samey like in this GIF so I added some randomness to the rotation of the destroyed crate object before exploding it making it more random.

Code I used was:

crateDestroyed.rotation = 
            Quaternion.Euler(
                _rng.Next(0, 3) * 90, 
                _rng.Next(0, 3) * 90, 
                _rng.Next(0, 3) * 90
            );

Also had to raise the transform up by two before instantiating the destroyed crate as I noticed some of the pieces where falling below the floor.

transform.up += new Vector3(0, 2, 0);

I think I like the result.

Yup that’s a great simple change, the position just has to have a tiny bit of randomness for the physics to end up different.
I quite like the top down view with the grenade flying super high, great job!

Privacy & Terms