player-physics

0.1.0 • Public • Published

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

/player-physics/

    Package Sidebar

    Install

    npm i player-physics

    Weekly Downloads

    3

    Version

    0.1.0

    License

    none

    Last publish

    Collaborators

    • maxogden