Mechropolis – Rotating the long way around

mechropolis_stationary_thrower_featured

During the development of Mechropolis, our level designer came to me requesting the ability to limit the area in which the Stationary Thrower robot could turn to keep it’s arms from clipping into walls and to give the level designer more control when creating challenges.

The robot in the image above is the Stationary Thrower. It turns toward the player and throws her into the air when she steps onto it’s plate, kind of like a robotic jump pad.

Limiting the angles allowed for the robot was not a problem, but smoothly turning toward it’s target angle while avoiding the restricted segment proved to be a bit more of a challenge than I had anticipated. I had previously used Unity’s built in Quaternion.RotateTowards function for this, but that function always does the shortest rotation possible which would cause the robot to rotate through obstacles if that was the shortest route.

I decided to approach the problem by manually rotating the robot towards it target on a plane with support for my own angular limits. I’ve tried keeping things as general as possible and while my use for this is limited to the xz-plane, this approach should work on any plane. (more…)

Event System in C++

event_system_featured

As a part of getting input into the game I’m working on for the programming course we’re taking right now, I wanted to implement some kind of event system. I come from a background in web development, working a lot with javascript and actionscript and I tend to draw inspiration from there. I always liked the flexibility and ease of use of the event handling in javascript and actionscript, and I wanted to try and do something similar with my system. (more…)

Theme by Simon Wulf