I am building a react based component using Potree viewer(from potreeconverter), enabling user to do free form selection(lasso) for a point cloud. This needs communication between parent react component and potree viewer inside iframe. So on my node backend, when index.html is served, I dynamically inject a custom js i index.html, and it contains all my custom js code to interact with potree viewer.
const injectScript = `<script src="/potree-custom/potreeviewer-utilities.js"></script>`
let modifiedData = data;
modifiedData = data + injectScript;
I am able to detect mouse clicks etc. Now I want to use THREEE raycaster api for further improvement. But I couldn’t get hold of THREE instance from potree.
Potree is available thanks to this in index.html:
But I can’t get hold of THREE instance.
What is correct way of doing so?