问题
I was looking to upgrade the three js which is used in autodesk forge behind the scene and reason for upgrade is I am trying to use this library and this need three js r71 and above and inside forge viewer it seems they are using r33. I found a blog where it showed me how can I take the advantage of later three js. I followed it but seems like its not working. There forge viewer now have 2 references of three js and it gets confused which one to use and hence some of code behave weird
here is one of the example happening to me
THREE.Object3D.add: object not an instance of THREE.Object3D.
I am getting this when I am trying to add a scene
some might would like to know what was happening with the three js which comes with forge viewer so here is the thing which is getting broken
I have also tried doing this below things adding source to three js
<script src=" https://cdnjs.cloudflare.com/ajax/libs/three.js/r122/three.min.js"></script>
So is there any other solution which I can try and make it work also If someone had tried meshline library and faced similar issue and have solution for it do let me know
回答1:
Forge Viewer uses Three.js version 71, and due to the way both libraries are written, it is unfortunately very difficult to port Forge Viewer to more modern versions of Three.js.
You can try back-porting parts of Three.js that you're interested in manually (I did that for the Potree point cloud library), but such work is not an officially supported.
来源:https://stackoverflow.com/questions/65017846/upgrade-three-js-version-in-autodesk-forge-viewer