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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@perplexdotgg/bounce-character-controller

v0.1.0

Published

Reference character controller implementation for the Bounce physics engine

Readme

npm version repo license PRs Welcome

Bounce Character Controller

This project is a reference Typescript implementation of a character controller created using the Bounce physics library.

This implementation is heavily inspired by Jolt's reference character controller implementation, and has the following features:

  • collision detection and resolution against all bounce shape and body types (e.g. height map, trimesh, etc)
  • character applies forces to dynamic bodies (and vice versa)
  • character can go up and down stairs
  • character can go up and down slopes while sticking to floor
  • character can jump while on the ground (air movement control is optional)

This library provides only the character controller logic and physics integration. Rendering and input handling are outside the scope of this library. You can find an example implementation that uses this library alongside basic keyboard + mouse input handling and rendering using ThreeJS at https://codeberg.org/perplexdotgg/bounce-character-controller-example/.

Although this is a fairly robust implementation, this is not intended as a game-ready implementation, rather it is intended as a starting point or reference for one.

Installation

For serious use, please fork and modify this library's source code. This package exists as a library mostly for prototyping convenience.

npm install @perplexdotgg/bounce-character-controller

Assumes you already have @perplexdotgg/bounce installed.

Usage

// initialization code
import { World } from '@perplexdotgg/bounce';
import CharacterController from '@perplexdotgg/bounce-character-controller';

const physicsWorld = new World();

const character = new CharacterController(physicsWorld, {
  inertiaDecayRate: 100,
  gravityScale: 1,
  walkingSpeed: 9,
  jumpingSpeed: 6,
  canControlMovementDuringJump: true,
  shouldCharacterStickToFloor: true,
});

const characterRadius = .4;
const characterHeight = .9;
const characterShape = physicsWorld.createCapsule({ radius: characterRadius, height: characterHeight });

// create the character
const characterBody = physicsWorld.createKinematicBody({
  shape: characterShape,
  position: [0, 10, 0],
  orientation: [0, 0, 0],
  belongsToGroups: NoneFlag,
  collidesWithGroups: NoneFlag,
});

character.setBody(characterBody);


// later, in your update function
// movementX and movementY should be in the range [-1, 1], representing the desired movement direction on the XZ plane
// (movementX, movementY) should already be normalized
character.setTargetMovement(movementX, movementY, isJumping);
character.update(deltaInSeconds);

// after the update(), you would put your code for updating your character mesh to the new position/orientation (i.e. copy from characterBody.position and characterBody.orientation)
characterMesh.position.copy(characterBody.position);
characterMesh.quaternion.copy(characterBody.orientation);

Default option values

{
  walkingSpeed: 30,
  jumpingSpeed: 15,
  gravity: { x: 0, y: -25, z: 0 },
  gravityScale: 1,
  inertiaDecayRate: 10,

  canControlMovementDuringJump: true,
  shouldCharacterStickToFloor: true,
  stickToFloorStepDownSpeed: 30,
  stickToFloorStepDownDistance: 0.5,

  shouldCharacterWalkStairs: false,
  walkStairsStepUpDistance: 0.4,
  walkStairsStepUpAmount: 0.4,
  walkStairsMinStepForward: 0.02,
  walkStairsStepForwardTest: 0.15,
  walkStairsCosAngleForwardContact: Math.cos(degreesToRadians(75)),
}

How to contribute

If you like this project and would like to support our work, please consider contributing code via pull requests, or donating via open collective. Contributions are greatly appreciated!