User Tools

Site Tools


160219 - Mouselook Goodness

Definitely meant to write this on Friday. Oops.

Mouselook is actually at this point now implemented in the game in a very basic way. I did a few things differently to what I've done in the past for FPS controllers:

  • The camera is the child of an empty, which is the child of the mech
    • This allows for the rotation of the empty on the Y axis and the camera on it's X axis (preventing stray rotations on the camera's Z axis), and for panning without turning the mech (camera rotation independent of the mech's orientation)
  • Input is taken from a virtual axis controlled by the mouse instead of directly from the mouse itself
    • This makes it waaaaaaaay easier to check, per frame, how much the mouse has moved

Right now it's a single script implemented directly on the camera. This will have to change to a slightly different structure once I've broken the mech model in half, so the camera can look around the inside of the cockpit while the cockpit itself is rotated by the mouse. This is key for things like VR support, or just added realism.

blog/160219_mouselook-goodness.txt · Last modified: 2016/02/22 08:53 by admin