Unit Keyboard Movement

1.1k Downloads

An easy to use keyboard movement system with both cardinal (north, south, east, west), and relative style movement.

Features:

  • Cardinal style of movement. Pressing forward makes a unit go north, left makes a unit go west, etc.. The directional north can be changed on a per player basis. Example: If you have a third person camera system you can make "north" equal to the camera facing so the unit will walk towards the camera facing when pressing forward.
  • Relative style of movement, with strafing. Forward will make the unit walk towards his facing, left will make him turn left, etc. Strafing left/right will cause the unit to walk towards his left/right.
  • Both modes support multiple key presses. Example: Using Cardinal movement, pressing forward and left will cause the unit to move NW. Using relative movement, a unit can turn while moving forward.
  • Both modes can support as many units as you'd ever need.
  • A movement mode can be switched for any unit on the fly.
  • Configurable keys.

Known Bugs/Issues (will be fixed soon):

  • While strafing, units will not also turn.
  • Moving forward, then stafing does not produce diagonal movement.
  • Moving forward, strafing, then releasing strafe does not return the unit to it's foward movement.
  • Relative movement does not work with Collossus (or any unit with "turret" facing).
  • Optimizations to be made.