How to get scene points outside of onScenePointerDown

Scene onScenePointerDown={this.clickEventHandler}

clickEventHandler = (e, scene) => {
let { pickedPoint } = scene.pick(scene.pointerX, scene.pointerY);
console.log(pickedPoint);
}

Here we are able to console the respective scene points, but the issue is we cannot fetch this corresponding value outside of this ‘clickEventHandler’ function even if we are assigned the value to a global variable.

And also if there is any flag value that is in true, are also getting as false inside this ‘clickEventHandler’ function. (cannot generate the actual flag value(if it is true)).

Here is a github repo, where you can see how it is accessed:

If your global variable is an class attribute you might have to additionally bind this?

Scene onScenePointerDown={this.clickEventHandler.bind(this)}
4 Likes