three.interaction.js icon indicating copy to clipboard operation
three.interaction.js copied to clipboard

Property 'on' does not exist on type 'Mesh'

Open johnywind opened this issue 6 years ago • 8 comments

I'm not able to use this lib in Angular2. I keep getting this error: Property 'on' does not exist on type 'Mesh' My code: var interaction = new Interaction(this.renderer, this.scene, this.camera) var cube = new THREE.Mesh( new THREE.BoxGeometry(3, 3, 3), new THREE.MeshPhongMaterial({ color: 0xffffff }) ); this.scene.add(cube); cube.on('pointerdown', function(ev) { console.log('pointerdown'); });

johnywind avatar Mar 21 '18 14:03 johnywind

can you tell me the version of three.js

jasonChen1982 avatar Mar 26 '18 01:03 jasonChen1982

you can update your three.js to last version

jasonChen1982 avatar Mar 26 '18 11:03 jasonChen1982

I already have the latest version of Three.js As far as I can't tell it doesn't import correctly as an angular module (threejs seems to be working correctly)

johnywind avatar Mar 26 '18 13:03 johnywind

how do you use it ? can you show me the whole code. i had test this lib on [email protected] right now.

jasonChen1982 avatar Mar 27 '18 13:03 jasonChen1982

I had the same problem (three 0.103.0), and I didn't find any other solutions than to use //@ts-ignore

I don't think this library is intended to be used in typescript

dc-p8 avatar Apr 06 '19 21:04 dc-p8

I have the same problem with in react ^16.8.6 and threejs r110 @jasonChen1982

pxim avatar Nov 22 '19 03:11 pxim

I have the same problem with in react ^16.8.6 and threejs r110 @jasonChen1982

I solved my question. https://github.com/jasonChen1982/three.interaction.js/issues/17

pxim avatar Nov 25 '19 01:11 pxim

I have the same problem within react ^16.8.6 and threejs r110 @jasonChen1982

I solved my question. #17

yes, because three.interaction import and add some patch for three, please ensure we import same three bundle

import * as THREE from 'three';

jasonChen1982 avatar Dec 20 '19 03:12 jasonChen1982