Skip to content

JasonTByrd/pick-helper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 

Repository files navigation

This is Pick Helper. It does one thing, picks objects in a 3d environment created with three js for you.

How to use:

First, install Pick Helper with this command
npm install pick-helper

Now import Pick Helper.
import PickHelper from pick-helper;

Next, create your pick helper.
pickHelper = new PickHelper(this.scene, this.camera);
or
pickHelper = new PickHelper(scene, camera)

Now you can use the .pick command to get the mesh your cursor is over.
pickHelper.pick(event, this.scene, this.camera, this.mount);
or
pickHelper.pick(event, scene, camera, mount);

Furthermore, you may also use the pickCenter method to pick what is in the center of your camera.
pickHelper.pickCenter(event, this.scene, this.camera, this.mount);
or
pickHelper.pickCenter(event, scene, camera, mount);

Disclaimer I have no interest in financial gain for this code and all are permitted to use it as they see fit.
special thanks to the creator of this tutorial: https://threejsfundamentals.org/threejs/lessons/threejs-picking.html
This code is based off their PickHelper class but converted into an object-oriented form for use in React, etc. and all contained within said class.

About

Three js pick helper

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published