Collisions & Fast Movers

I’ve been experimenting with some new bead attack modes. One thing Glace can do now is make beads zip back to him super fast in a straight line. This causes beads to slash through the air in a line between Glace and wherever the beads was when the attack was triggered. Since the beads move so fast in this case, I can’t rely on overlap tests between colliders. I had to go ahead and add ray cast collision tests for this. I use Physics2D.CircleCastNonAlloc(…) in this case.

A bead slash attack cuts through an enemy. The bead moves so fast that ray casts are needed to detect the collisions.

A bead slash attack cuts through an enemy. The bead moves so fast that ray casts are needed to detect the collisions.

Ray casts are used to detect collisions between Glace and the environment as well. In the original game, I only used overlap tests, which would cause Glace to move through walls if he was moving too fast. I had to put a bunch of hacks in place to reduce the chances of this, like minimum time steps, which ended up being a pretty bad idea in practice. It’s nice to know we won’t have to worry about this now.

I also imported UniRx today and put it to work. I was so happy to see Rx extensions for Unity!.