an attempt at first person shooter physics for three.js
JavaScript
Latest commit e49f2b6 Jan 28, 2013 @maxogden 0.1.0
Permalink
Failed to load latest commit information.
.gitignore use events for directions Jan 10, 2013
README.md version 0.0.1 Jan 10, 2013
index.js support for jump set to zero and gravityEnabled in opts arg Jan 27, 2013
package.json 0.1.0 Jan 28, 2013

README.md

player-physics

an attempt at first person shooter physics for three.js. based originally on PointerLockControls.js from @mrdoob in three.js but heavily modified

works in the client or on the server. use browserify for client side usage

built for voxeljs and used in voxel-engine

install

npm install player-physics

example

var playerPhysics = require('player-physics')
var player = playerPhysics()
player.enabled = true
player.moveForward = true
player.tick(200) // milliseconds since last tick
console.log(player.velocity)

using the streaming api with the interact module (for pointerlock):

var interact = require('interact')
var pointer = interact()
pointer.on('attain', function(movements) {
  player.enabled = true
  movements.pipe(player)
})
pointer.request()

license

BSD