You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to build a React component to render the Leapmotion boneHand model from 'leapjs-plugins'. As advertised in the boneHand plugin demo code below should be the easiest way to add hands to a THREE.js application. In vanila JS this was straightforward with a canvas element.
// At the simplest:
Leap.loop()
.use('boneHand', {
targetEl: document.body,
arm: true
});
However I found that in React, I need to use React-Three-Renderer (R3R), which is a Three.js wrapper. I am running into issues trying to inject the Leap boneHand meshes into the Scene that is created by R3R in the React component Render method, just like bellow.
There is an optional parameter to provide a THREE.scene to Leap.loop(). I need to get the reference of the scene component above into an instance variable like so
<scene ref={node => this.setupScene(node)}>
Now, the first thing that I tried was to use React lifecycle componentDidMount method to start the Leap.loop
`componentDidMount(){
console.log('componentDidMount');
console.log(this.leapScene);
(window.controller = new Leap.Controller())
.use('boneHand', {
scene: this.leapScene,
opacity: 3,
arm : false
})
.connect()
// Leap.loop({background: true}) // ALTERNATIVE CODE THAT YIELDS THE SAME ERRORS
// .use('boneHand', {
// scene: this.leapScene,
// opacity: 3,
// arm : false
// })
// .connect()
}`
This approach gives 86 errors of this type, which must refer to the different elements of the hand models.
index.js:2178 THREE.Object3D.add: object not an instance of THREE.Object3D. ./node_modules/leapjs-plugins/node_modules/three/three.js.THREE.Mesh
I'm not sure what it is but it seems an internal incompatible type in the Leap.controller or Leap plugin.
Any ideas about this?
The text was updated successfully, but these errors were encountered:
frantic0
changed the title
Trying to rendering Leap.js in with React-Three-Renderer
Trying to render Leap.js boneHands in with React-Three-Renderer
Jan 27, 2018
frantic0
changed the title
Trying to render Leap.js boneHands in with React-Three-Renderer
Trying to render Leap.js boneHands in React-Three-Renderer
Jan 27, 2018
frantic0
changed the title
Trying to render Leap.js boneHands in React-Three-Renderer
Trying to render Leap.js boneHands in React-Three-Renderer (approach #1)
Jan 27, 2018
Hello,
I am trying to build a React component to render the Leapmotion boneHand model from 'leapjs-plugins'. As advertised in the boneHand plugin demo code below should be the easiest way to add hands to a THREE.js application. In vanila JS this was straightforward with a canvas element.
However I found that in React, I need to use React-Three-Renderer (R3R), which is a Three.js wrapper. I am running into issues trying to inject the Leap boneHand meshes into the Scene that is created by R3R in the React component Render method, just like bellow.
There is an optional parameter to provide a THREE.scene to Leap.loop(). I need to get the reference of the scene component above into an instance variable like so
<scene ref={node => this.setupScene(node)}>
Now, the first thing that I tried was to use React lifecycle
componentDidMount
method to start the Leap.loop`componentDidMount(){
}`
This approach gives 86 errors of this type, which must refer to the different elements of the hand models.
index.js:2178 THREE.Object3D.add: object not an instance of THREE.Object3D. ./node_modules/leapjs-plugins/node_modules/three/three.js.THREE.Mesh
I'm not sure what it is but it seems an internal incompatible type in the Leap.controller or Leap plugin.
Any ideas about this?
The text was updated successfully, but these errors were encountered: