Code Monkey home page Code Monkey logo

cesium-leap's Introduction

CesiumLeap

A library that allows Leap Motion navigation for Cesium.

The library depends on the Leap Motion javascript library, a Leap Motion Controller (duh) and has been tested with Cesium version b28, the latest at the time of writing. You will need to install the Leap Motion software that comes with the device.

Installation

bower install cesium-leap

Then include the library in your source.
<script src="path-to-cesium-leap/dist/cesiumLeap.js"></script>

The library is also AMD compatible, just make sure you configure Leap as a module as well. At the time of this writing, Leap needed an export shim to work properly with requirejs.

require.config({
    baseUrl: '.',
    "paths" :{
        "CesiumLeap" : "path-to-cesium-leap/CesiumLeap",            
        "Leap" : "path-to-leapjs/leap"
    },
    shim :  {
        Leap : {exports : 'Leap'}
    }
});

Usage:

The library needs the Ellipsoid and the Scene to do its work, pass these in as options:

var cesiumLeap = new CesiumLeap({
	scene : myScene,
	ellipsoid : myEllipsoid
});

That's basically it, it will automatically register with the Leap motion when it can and allow you to fly around.

#Flying directions:

  • CesiumLeap works only with one hand.
  • There's a built-in delay to allow you to get your hand in a neutral position.
  • If at anytime you want to stop, just make your hand into a fist.
  • Moving your hand left or right will move the camera left or right
  • Moving your hand forward or backward will move the camera forward and backward. Note, this means you may be moving down in altitude if you are looking at the earth.
  • Tilting your hand up and down will have the camera look up and down.
  • If you rotate your hand left or right, the camera will rotate that direction. Try to think of your hand is an airplane, that helps me.
  • You can also twist your hand at the wrist and it will "twist" the camera. If you want to fly around something, it often helps to rotate and twist at the same time, I find the airplane analogy helpful here as well.

Known issues:

  • Plugin does not work well in 2D mode.
  • Plugin will work in 2.5D mode (Columbus), but as you zoom closer to ground, fails to slow down appropriately, making it a bit unwieldy.

Contributing

Contributions welcome. Use Pull Requests. Would love to add gestures and an actual API for leap events.

License

MIT Style license

#Building the minified version node tools/r.js -o tools/build.js

#Tests to run tests: python -mSimpleHTTPServer

cesium-leap's People

Contributors

jrburke avatar mmacaula avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.