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

angular-three-ecctrl

v4.2.4

Published

Ecctrl character controller for Angular Three

Readme

angular-three-ecctrl

angular-three-ecctrl is a dynamic, floating-capsule character controller for Angular Three and Rapier. It ports the core locomotion model from pmndrs/ecctrl while keeping input source-agnostic: keyboard, gamepad, touch, AI, and network adapters can all drive the same controller.

Installation

npm install angular-three-ecctrl angular-three-rapier @dimforge/rapier3d-compat
# yarn add angular-three-ecctrl angular-three-rapier @dimforge/rapier3d-compat
# pnpm add angular-three-ecctrl angular-three-rapier @dimforge/rapier3d-compat

Usage

NgteEcctrl owns its dynamic rigid body and capsule collider, so it must be rendered beneath NgtrPhysics. Project the visual character into it, and call setMovement() from your preferred input adapter.

import { Component, CUSTOM_ELEMENTS_SCHEMA, viewChild } from '@angular/core';
import { NgteEcctrl } from 'angular-three-ecctrl';
import { NgtrPhysics, NgtrRigidBody } from 'angular-three-rapier';

@Component({
	selector: 'app-character-scene',
	template: `
		<ngtr-physics>
			<ng-template>
				<ngt-object3D rigidBody="fixed" [position]="[0, -0.25, 0]" [options]="{ colliders: 'cuboid' }">
					<ngt-mesh [scale]="[10, 0.5, 10]">
						<ngt-box-geometry />
						<ngt-mesh-standard-material color="#334155" />
					</ngt-mesh>
				</ngt-object3D>

				<ngte-ecctrl #player="ecctrl" [position]="[0, 1, 0]">
					<ngt-mesh>
						<ngt-capsule-geometry />
						<ngt-mesh-standard-material color="orange" />
					</ngt-mesh>
				</ngte-ecctrl>
			</ng-template>
		</ngtr-physics>
	`,
	imports: [NgteEcctrl, NgtrPhysics, NgtrRigidBody],
	schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
export class CharacterScene {
	readonly player = viewChild<NgteEcctrl>('player');

	setMovement() {
		this.player()?.setMovement({ forward: true, run: true });
	}
}

setMovement() merges partial updates. The public input shape supports forward, backward, leftward, rightward, run, jump, and an optional { x, y } joystick. The controller exposes an imperative handle with live body, collider, and state values, plus setLockForward() and setForwardDir() for imperative integrations.

NgteEcctrl also follows Angular Rapier's transform and event contract: use [rotation] for Euler values or [quaternion] for quaternion values, and subscribe to (wake), (sleep), (collisionEnter), (collisionExit), (intersectionEnter), (intersectionExit), or (contactForce) on the controller itself.

Gravity fields

Enable position-dependent gravity per controller with options.gravityField, or configure a scene-wide field through the injectable NgteEcctrlGravity service. A constant options.customGravity vector remains available as shorthand.

import { Injectable } from '@angular/core';
import { NgteEcctrlGravity } from 'angular-three-ecctrl/gravity';
import * as THREE from 'three';

@Injectable({ providedIn: 'root' })
export class PlanetGravity {
	constructor(gravity: NgteEcctrlGravity) {
		gravity.setGravityField((position) => position.clone().normalize().multiplyScalar(-9.81));
	}
}

The controller disables native gravity on its owned body while custom gravity is enabled, then applies the field as a no-wake impulse during each Rapier substep so an idle character can still sleep. The standalone [ecctrlGravity] body directive is additive instead; set the parent NgtrPhysics gravity to [0, 0, 0] when that directive should replace native world gravity.

Animation state adapter

Import NgteEcctrlAnimationState from angular-three-ecctrl/animation to derive stable high-level locomotion states from physics:

<ngte-ecctrl animationState (animationStateChange)="playAnimation($event)">
	<!-- character mesh -->
</ngte-ecctrl>

The default states are IDLE, WALK, RUN, JUMP_START, JUMP_IDLE, JUMP_FALL, and JUMP_LAND. Supply [resolver] for an application-specific animation graph.

Entry points

The root entry point contains only the character controller and its public types. Import optional features directly:

| Entry point | Purpose | | -------------------------------- | ---------------------------------------------------------------- | | angular-three-ecctrl/animation | Locomotion animation-state directive | | angular-three-ecctrl/camera | [ecctrlCameraFollow] adapter for NgtsCameraControls | | angular-three-ecctrl/curves | Curve data, LUT baking, and evaluation | | angular-three-ecctrl/gravity | Shared gravity fields and the [ecctrlGravity] body directive | | angular-three-ecctrl/input | Touch joystick, virtual button, and declarative movement binding | | angular-three-ecctrl/time | Deterministic control of a paused Rapier world | | angular-three-ecctrl/vehicle | Shape-cast cars and thrust-propeller drones |

NgteTimeControl must be nested under an NgtrPhysics configured with paused: true; it advances that world through NgtrPhysics.step(delta) and refuses to double-step an automatically advancing world.

For interactive curve editing, angular-three-tweakpane/curve provides the structurally compatible TweakpaneCurve. There are intentionally no /all or /leva entry points: applications import only the features they use.