incomplete code for collision detection with terrain