max-mapper / voxel-engine

3D HTML5 voxel game engine
http://maxogden.github.com/voxel-engine
BSD 3-Clause "New" or "Revised" License
1.29k stars 220 forks source link

Don't throw errors if no player is set up to control. #55

Closed timoxley closed 11 years ago

timoxley commented 11 years ago

if there's no this.controls.target(), game.playerPosition() returns false, yet all the methods that use game.playerPosition() ignore this possibility, thus, if you don't set up an object to control, the engine becomes unhappy.

This gives the engine a sensible default in lieu of a real player position (the game.camera.position).