# voxel-trajectory

> Calculate a trajectory in voxel.js

Latest version **0.2.0** (published 2013-05-01) · 0 weekly downloads

## Install

```sh
npm install voxel-trajectory
pnpm add voxel-trajectory
yarn add voxel-trajectory
bun add voxel-trajectory
```

## Health

**Score 10/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; low quality score; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.0 |
| Published | 2013-05-01 |
| First published | 2013-01-22 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 0.8.0 |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 10 |
| Author | Kyle Robinson Young |
| Maintainers | shama |
| Keywords | voxel, trajectory, math |

## Links

- npm: https://www.npmjs.com/package/voxel-trajectory
- Repository: https://github.com/shama/voxel-trajectory
- Issues: https://github.com/shama/voxel-trajectory/issues
- npm.io page: https://npm.io/package/voxel-trajectory

## Alternatives

- [random-seedable](https://npm.io/package/random-seedable.md) — 27.9K weekly downloads
- [n2words](https://npm.io/package/n2words.md) — 22.2K weekly downloads
- [@stdlib/math-base-special-factorialln](https://npm.io/package/@stdlib/math-base-special-factorialln.md) — 5.7K weekly downloads
- [@stdlib/math-base-special-abs2](https://npm.io/package/@stdlib/math-base-special-abs2.md) — 1.7K weekly downloads
- [commons-math-interpolation](https://npm.io/package/commons-math-interpolation.md) — 1.4K weekly downloads

## Recent versions

- 0.2.0 (latest) — 2013-05-01
- 0.1.0 — 2013-01-22

## README

# voxel-trajectory

> Calculate trajectories in [voxel.js](https://github.com/maxogden/voxel-engine).

[View the voxel-throw example](http://shama.github.com/voxel-throw)

# example

Create a trajectory to throw an item based on the direction the camera is
facing:

``` js
var trajectory = require('voxel-trajectory');

// x,y of voxel.js camera
var camera = game.cameraRotation();

// rotate the axis -90 degs to throw forward
camera[0] -= Math.PI / 2;

// create an item with a velocity of 2 towards trajectory
var item = {
  velocity: trajectory(2, camera),
  mesh: /* ... */,
  size: game.cubeSize,
  resting: false
};
game.addItem(item);
```

The trajectory can be from anywhere, such as a meteor:

```js
var meteor = {
  velocity: trajectory({
    // pretty fast
    velocity: 5,
    // 45 degrees
    rotation: [Math.PI / 180 * 45, Math.PI / 180 * 45, 0],
    // from the sky
    origin:   [1000, 5000, 1000]
  })
};
```

# api

`trajectory([velocity:number, rotation:[x, y, z], origin:[x, y, z]])`

# install

With [npm](https://npmjs.org) do:

```
npm install voxel-trajectory
```

Use [browserify](http://browserify.org) to `require('voxel-trajectory')`.

## release history
* 0.2.0 - update to use arrays
* 0.1.0 - initial release

## license
Copyright (c) 2013 Kyle Robinson Young<br/>
Licensed under the MIT license.

---
_Source: https://npm.io/package/voxel-trajectory · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
