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

threejs-cannones-tube

v0.0.9

Published

![cover](https://github.com/bandinopla/threejs-cannones-tube/raw/main/cover.jpg) # Threejs + CANNON-es = TUBES!! Ever felt a deep existential sadness because making flexible 3D tubes that obey physics is a total brain-melter? Of course you did! Me too! So

Readme

cover

Threejs + CANNON-es = TUBES!!

Ever felt a deep existential sadness because making flexible 3D tubes that obey physics is a total brain-melter? Of course you did! Me too! So I bullied a few of my brain cells into holding hands, forming a support group, and conjuring up this lovely little package to make the pain go away. You're welcome.

Live demo

The cables of the claw machine here are done using this object: https://threejs-claw-machine.vercel.app/

Installation

This uses ThreeJs and Cannon-es

npm install threejs-cannones-tube

Use

import { CannonTubeRig } from 'threejs-cannones-tube'
const tube = new CannonTubeRig(
    1, // length in world units 
    20, // resolution along the segment's length
    0.02, // radius of the tube
    8 // resolution along the radius
    ); //<- extends SkinnedMesh
tube.material = new THREE.MeshPhysicalMaterial({ color: 0xff0000 })
scene.add(tube)
tube.addToPhysicalWorld(world); // word = your CANNON.World

function update() {
    //your update function....
    tube.syncRig(); //<-- will align the bones witht  he physical bodies 
}

Head and tail

To get access to either the head or tail do...

tube.head; // is a CANNON.Body
tube.tail; // is a CANNON.Body

Align

To align the tube, move the object like any other Object3D and use lootAt to make the tube point at a specific target point...

You must do these 2 steps, not just changing the position, because the "lookAt" is what triggers the alignment (If you change the position but dont call lookAt nothing will happen)

 tube.position.copy( targetPosition )
 tube.lookAt( somePointOfInterest)

Tension

You can tweak a property tension that is a number uset to scale the offset between segments... effectively contracting or exanding it will make the tube longer or shorter...

tube.tension = 1.3; // tweak this...

this will reposition the physical bodies and update their offsets I haven't tested changing these for animating only during setup to place the tube where I want before starting the simulation. (before the first render)

Remove

tube.removeFromPhysicalWorld( world )
tube.removeFromParent()