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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@threejs-addons/threejs-addons

v0.3.0

Published

free & opensource threejs addons to boost productivity

Downloads

228

Readme

ThreeJS-Addons

Introduction

This project is a collection of ThreeJS Addons to speedup productivity when working with ThreeJS projects. The Project comprises of the following:

Installation

You can get the package via npm:

npm i --save @threejs-addons/threejs-addons

Usage

To begin using the addons, simply import them into your project

import {
    CameraController,
    RapierColliderController, 
    TranslationController,
 } from '@threejs-addons/threejs-addons';
import { utils } from '@threejs-addons/threejs-addons';

/** get default options for your class instances */
const { DEFAULT_OPTIONS }  = utils;

/** instantiate the camera controller class i.e CCC */
const CCC = new CameraController({ scene: scene }); //controller adds cameras to your scene


/** assuming your application requires collison detection for the controllers **/
/** we have implemented a Rapier collider controller  class or simply RCC */
const offset = 0.5;
const RCC = new RapierColliderController({ world: world as RAPIER.World, offset, options: DEFAULT_OPTIONS });


/** instantiate the translation controller class or simply TCC **/
const TCC = new TranslationController({ options: DEFAULT_OPTIONS });


/** somewhere in your code, you use the TCC to handle all translations */
TCC.setCCC(CCC);
TCC.set(RCC);


/** you may want to set up event listerners some where in your code*/

window.addEventListener('keydown', (e) => {

    if(e.key === 'w'){
        RCC.setTranslateZDirection(true, 1)
        // TCC.setTranslateZDirection(true, 1)
    }

    if(e.key === 's'){
        RCC.setTranslateZDirection(true, -1)
        // TCC.setTranslateZDirection(true, -1)
    }

    if(e.key === 'a'){
        RCC.setTranslateXDirection(true, 1);
        // TCC.setTranslateXDirection(true, 1)
    }
    

    if(e.key === 'd'){
        RCC.setTranslateXDirection(true, -1);
        // TCC.setTranslateXDirection(true, -1)
    }

    if(e.key === 'ArrowLeft'){
        CCC.switchControlTypeNext(null); //switch controls
    }

    if(e.key === 'ArrowRight'){
        CCC.switchControlTypeNext(null); //switch controls
    }

    if(e.key === 'c'){
        CCC.switchControllerNext(null);  //switch cameras          
    }
})

window.addEventListener('keyup', (e) => {
    if(e.key === 'w'){
        RCC.setTranslateZDirection(false, null)
        // TCC.setTranslateZDirection(false, null)
    }

    if(e.key === 's'){
        RCC.setTranslateZDirection(false, null)
        // TCC.setTranslateZDirection(false, null)
    }

    if(e.key === 'a'){
        RCC.setTranslateXDirection(false, null)
        // TCC.setTranslateXDirection(false, null)
    }

    if(e.key === 'd'){
        RCC.setTranslateXDirection(false, null)
        // TCC.setTranslateXDirection(false, null)
    }
})


function animate(){
    /** asuming you have some animate loop in your code*/
    TCC.update(delta, true);
}


API Documentation

The controllers are documented in the following links:

  1. Camera Controller Class(CCC) .
  2. Rapier Collider Controller Class(RCC) .
  3. Translation Controller Class(TCC) .

Contributing

@todo

License

This project is licensed under the MIT License.