demo of grab-objects-advanced scene running in preview.
Demonstrates how you can grab and move an object using the cannon.js physics engine. This is the advanced version of this scene here. To view the scene, please visit here.
- Use your mouse to look around and W A S D keys on your keyboard to move forward, left, backward and right respectively.
- To jump, press the Space key.
- To grab the object, click and hold the Left Mouse Button.
- Press and hold the E key to pull the object in.
There are a couple of issues that need looking at:
- Object reorientates itself when you first pick it up.
- Making large arcs/turns whilst holding the object can cause the object to go out of bounds.
Install the CLI
Download and install the Decentraland CLI by running the following command:
$ npm i -g decentraland
Previewing the scene
Download this example and navigate to its directory, then run:
$ dcl start
Code is adapted from https://github.com/schteppe/cannon.js/blob/master/examples/threejs_mousepick.html