# game-shell-orbit-camera

> Attaches an orbit-camera to a game-shell with default key bindings

Latest version **1.0.0** (published 2014-05-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install game-shell-orbit-camera
pnpm add game-shell-orbit-camera
yarn add game-shell-orbit-camera
bun add game-shell-orbit-camera
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2014-05-21 |
| First published | 2013-07-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 11 |
| Author | Mikola Lysenko |
| Maintainers | mikolalysenko |
| Keywords | camera, webgl, 3d, orbit, quaternion, game-shell, orbit-camera, arcball, rotation, default, key |

## Links

- npm: https://www.npmjs.com/package/game-shell-orbit-camera
- Repository: https://github.com/mikolalysenko/game-shell-orbit-camera
- Issues: https://github.com/mikolalysenko/game-shell-orbit-camera/issues
- npm.io page: https://npm.io/package/game-shell-orbit-camera

## Dependencies (1)

- [orbit-camera](https://npm.io/package/orbit-camera.md) ^1.0.0

## Alternatives

- [jsforce](https://npm.io/package/jsforce.md) — 851.2K weekly downloads
- [react-native-qrcode-svg](https://npm.io/package/react-native-qrcode-svg.md) — 693.5K weekly downloads
- [@salesforce/plugin-data](https://npm.io/package/@salesforce/plugin-data.md) — 394.9K weekly downloads
- [@backstage/plugin-search-common](https://npm.io/package/@backstage/plugin-search-common.md) — 308.5K weekly downloads
- [@chain-registry/types](https://npm.io/package/@chain-registry/types.md) — 38.4K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2014-05-21
- 0.0.2 — 2014-04-12
- 0.0.1 — 2014-04-12
- 0.0.0 — 2013-07-07

## README

game-shell-orbit-camera
=======================
Creates a default orbit camera controller for a [game-shell](https://github.com/mikolalysenko/game-shell) instance.  The controls for this are as follows:

* Rotate - Left click
* Pan - Right click or Control + Left click
* Zoom - Scroll or Shift + Left click

## Example

"use strict"

```javascript
var shell = require("gl-now")()
var createMesh = require("gl-mesh")
var simple3DShader = require("simple-3d-shader")
var attachCamera = require("game-shell-orbit-camera")
var glm = require("gl-matrix")
var mat4 = glm.mat4

var shader, mesh
var camera = attachCamera(shell)

camera.lookAt([0, 3, 20], [0, 3, 0], [0, 1, 0])

shell.on("gl-init", function() {
  shader = simple3DShader(shell.gl)
  mesh = createMesh(shell.gl, require("bunny"))
})

shell.on("gl-render", function(t) {
  //Bind shader
  shader.bind()

  //Set camera parameters
  var scratch = mat4.create()
  shader.uniforms.model = scratch
  shader.uniforms.projection = mat4.perspective(scratch, Math.PI/4.0, shell.width/shell.height, 0.1, 1000.0)
  shader.uniforms.view = camera.view(scratch)
  
  //Draw object
  mesh.bind(shader)
  mesh.draw()
  mesh.unbind()
})
```

## Install

    npm install game-shell-orbit-camera


### `require("game-shell-orbit-camera")(shell)`
Attaches a camera to the game-shell instance

**Returns** An instance of [`orbit-camera`](https://github.com/mikolalysenko/orbit-camera)

## Credits
(c) 2013 Mikola Lysenko. MIT License

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