npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

voxel-control

v1.0.0

Published

manipulate voxel-physical objects in a fps-style fashion

Downloads

163

Readme

voxel-control

manipulate voxel-physical objects using a state object. implements basic FPS controls. is a through stream of sorts -- it relies on voxel-engine to call control.tick(dt) to start producing events. it will buffer events when paused.

options

// default values are in terms of 1 voxel width
{ speed: Number(0.0032)                 // starting speed
, walkMaxSpeed: Number(0.0056)          // max walking speed
, runMaxSpeed: Number(0.0112)           // max running speed
, jumpMaxSpeed: Number(0.016)           // max jump speed
, jumpMaxTimer: Number(200)             // maximum amount of time jump will be applied in MS
, jumpSpeed: Number(0.004)              // starting jump speed
, jumpSpeedMove: Number(0.1)            // velocity modifier to use when moving laterally while in the middle of a jump
, accelTimer: Number(200)               // time to reach full speed on X/Y
, accelerationCurve: Function()         // function(current, max) -> [0-1]
                                        // defaults to a sin curve.
, airControl: Boolean(true)             // can player control direction without being on the ground?
, fireRate: Number(0)                   // MS between firing
, discreteFire: Boolean(false)          // does firing require mousedown -> mouseup, or can it be held?
, onfire: Function()                    // function(state) -> undefined
, rotationXMax: Number(33)              // maximum x rotation in a tick
, rotationYMax: Number(33)              // maximum y rotation in a tick
, rotationZMax: Number(33)              // maximum z rotation in a tick
, rotationMax: Number(33)               // maximum rotation in a tick -- other 
                                        // rotation maximums fallback to this value
, rotationXClamp: Number(Math.PI / 2)   // clamp x rotation to +/- this value
, rotationYClamp: Number(Infinity)      // clamp y rotation to this value
, rotationZClamp: Number(0)             // clamp z rotation to this value
, rotationScale: Number(0.002) }        // constant scale of rotation events, applied during tick

api

control(state, opts) -> Control

state is a state object (probably supplied by kb-controls).

opts is an object optionally containing any of the above.

Control#target(target?) -> target

target is the object to be manipulated. Assumed to have .acceleration, .velocity, and .atRestY() -> -1, 0, 1.

if a target is passed, set control to target that argument.

return the current target.

Control#tick(dt) -> undefined

advance the simulation. if there are any listeners for 'data', it will either buffer or emit a data event containing the control state at this tick.

interactStream.pipe(controls) -> controls

the interact module emits dx/dy/dz modifications from mouse movements / pointer lock; it can be piped to this stream.

license

MIT