Game Development with Three.js by 2013

Game Development with Three.js by 2013

Author:2013
Language: eng
Format: epub
Publisher: Packt Publishing


For our shooter game, we'll use voxel collision and a little bit of manual intersection. Unfortunately, all the physics libraries are large, so we don't have space to cover their APIs here. However, Cannon.js and Physi.js have examples specifically for use with Three.js available from their project pages.

Voxel collision

If we try to walk around our world now, we'll just fall through the floor. Let's create a function to check for collision between the player and the voxel world:

function checkPlayerCollision(player) { player.collideFloor(floor.position.y); var cell = mapCellFromPosition(player.position); switch (cell.char) { case ' ': case 'S': break; case 'X': moveOutside(cell, player); break; } }



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.