February 8, 2018

The First Entry In Our New Devblog Series: A Story About Physics And Colliders.

Greetings Legends!
We have been pondering ways to bring you more frequent updates while not spoiling anything fun we have planned for you. The answer was simple: let's get everyone talking about what they're doing with some devblogs! We're going to kick it off with a quick entry from our lead programmer, Ben Marcus!

Have you ever invested hours into solving a problem that in the end didn't really need solving? Yeah, sometimes I wish I could travel back in time just to slap myself before I start down the wrong path when debugging.

The wrong path

Well here are some basics about Unity collision and physics...

You have colliders which may or may not collide with one another depending on how you set them up. A rigidbody that houses physics properties like mass, drag etc. Add one of those to an object that already has a collider and voila, you have a physics object. Throw a non-kinematic, physics object at a wall and it will fall/bounce/react according to it's (collider) shape, mass, velocity and the surface it  hits. If the wall was non-kinematic then it would also move based on the force of the object thrown at it.

Maybe I'm already getting too technical, so lets get to the issue: fighting off EVIL WOLVES OF DOOM! If you look closely at the above gif, you will notice that Teddy is not standing on the ground, but in fact performing an amazing unwanted) acrobatic feat of agility. In Legends of the Brawl, the player character is a non-kinematic physics object that is moved by forces. The enemies, on the other hand, are kinematic objects who define their own position. This  means the player gets moved by what it hits and the wolves don't move unless told to. The wolves have a lunge attack that causes them to move just short of their targets position. If the player character is moving towards the wolf at  the same time as this attack we get this amazing display of acrobatics where the player character just flops over the wolf or stands on top of it.

I know what you're thinking,“Well obviously you need to account for the player characters velocity when the wolf is determining it's stopping point!” That's exactly what I was doing, and tweaking, and tweaking, and tweaking, until we had a team meeting and someone said, “why don't we just allow the player to clip through certain enemies.” After all the goal is fun, fast paced combat and collision with smaller characters just made it feel clunky. I toggled off the player collider on the wolf and no more unwanted acrobatics!

That's it for this week, but expect to hear from us again soon! Next week we'll be hearing from Richard Hunter about some of the music for Legends of the Brawl!

Thanks for tuning in! 

Want to chat with us?
Get in touch with us and share some thoughts with us on FacebookTwitter and chat with us on Discord!

Want to help support us?
Come give us a follow on Brightlocker where you will be able to snag some cool swag both in and out of game!