I am currently trying to import a WebGL engine known as PlayCanvas. It is very similar to three.js, but unlike three.js
; it unfortunately does not have a npm package/bundle. Through the solution I got from this StackOverflow
solution; I downloaded the engine code and imported it into my React Component.
The weird problem is that there is errors in the playcanvas.min.js
I imported. I know for a fact that the engine code is correct, however the code relies on a physics engine called ammo.js and most of the not defined
are as follows...
When I try to import the physics engine ammo.js
into the playcanvas engine, my local host server crashes and refuses to render anything.
Line 3: 'define' is not defined no-undef
Line 4: 'define' is not defined no-undef
Line 780: 'webkitAudioContext' is not defined no-undef
Line 880: Unexpected use of 'self' no-restricted-globals
Line 1125: 'Ammo' is not defined no-undef
Line 1125: 'Ammo' is not defined no-undef
Line 1125: 'Ammo' is not defined no-undef
Line 1125: 'Ammo' is not defined no-undef
I believe the main problem is that
<script src="https://code.playcanvas.com/playcanvas-latest.js"></script>
is very different from import * as pc from './playcanvas.min.js'