/threejs-position-util

measuring geometry positions for three.js

Primary LanguageTypeScriptMIT LicenseMIT

threejs-position-util

measuring geometry positions for three.js

MIT License CI_Main Maintainability Test Coverage

ReadMe Card

Demo

View Demo Page and open console.

Vector3
x: 960
y: 540
z: 0

threejs-position-util output a geometry position on screen.

Getting Started

Install

npm install @masatomakino/threejs-position-util --save-dev

Import

At first, import a class.

import { PositionUtil } from "@masatomakino/threejs-position-util";

Functions

API documentation

Call static functions in PositionUtil class.

PositionUtil.getGeometryCenterInWorld(mesh);
PositionUtil.getGeometryCenterInLocal(mesh);
PositionUtil.get2DPositionWithMesh(mesh, camera, W, H);

Functions return a position as THREE.Vector3.

see also demo page.

License

MIT licensed.