Tuesday, March 18, 2014
Equica's New Collision System
I tried coding this thing with simple boxes that touched each other and executed whatever methods I wanted. What seemed simple turned into a complex and messy web. After doing research I found that Unity once again has something to do it for me. The character controller component let's top-down characters move around and collide dynamically with walls (or anything with a non-kinematic, non-trigger collision box).
I had to rewrite how moving clover around works but the result was wall collision that didn't look buggy. The sacrifice was taking out the bounce effect I had for Clover's movement. I loved that bounce. I needed it. So I spent a day trying to get it to work with the new controls. The solution was simple so of course it took forever to realize. I could just use both my collision schemes together. One box for the walls detects the wall itself and another box outside the edges tells Clover to stop bouncing so she doesn't clip through walls.
Then just to be extra safe I mad it so that if anyone broke through a wall, they would hit a net that sends them back to where they entered the room from on contact.