iso74
October 30, 2020, 8:09pm
1
Hi, when I export a project from the Editor there is this file in Zip:
ammo.dcab07b.js
I can see that main difference is the instance is called AmmoLib not Ammo.
What is it exactly? Is this a special build of Ammo.js for PlayCanvas?
I want to use the PlayCanvas npm package (npm install playcanvas)
It seems that this file is missing there…
Also there is the package npm install ammo.js but with non of their versions
PlayCanvas physics with engine only works, only with the ammo.dcab07b.js file
Can someone help or clarify, please?
Thanks a lot!
will
October 30, 2020, 9:43pm
2
Here is a copy of ammo.dcab07b.js:
http://code.playcanvas.com/ammo.dcab07b.js
If you scroll to the bottom of the file, you will find the following line:
Ammo = AmmoLib();
ammo.dcab07b.js is just a reasonably old build of Ammo.js from the main repo:
To be specific, it’s this commit:
committed 06:30PM - 08 Nov 16 UTC
However, these days, we recommend you use the WASM build of ammo.js. A copy of it is checked into the engine repo here:
It’s loaded like this (if you’re using the engine without the Editor):
}
</style>
</head>
<body>
<!-- The canvas element -->
<canvas id="application-canvas"></canvas>
<!-- The script -->
<script>
if (wasmSupported()) {
loadWasmModuleAsync('Ammo', '../lib/ammo/ammo.wasm.js', '../lib/ammo/ammo.wasm.wasm', demo);
} else {
loadWasmModuleAsync('Ammo', '../lib/ammo/ammo.js', '', demo);
}
function demo() {
// *********** Initialize application *******************
var canvas = document.getElementById("application-canvas");
// Create the application and start the update loop
We do not include ammo.js in our NPM module because it’s really a separate product (and a dependency of PlayCanvas) - not a core part of it.
iso74
October 30, 2020, 9:56pm
3
@will Thanks for clarifying. This is obviously not the way a frame like Vue is including this
But I will find a workaround…
will
October 30, 2020, 10:34pm
4
Yeah, I’m afraid I know nothing about Vue so I can’t help with that. But good luck figuring something out!
iso74
November 1, 2020, 9:50am
5
@will I now posted my solution:
Hi all,
after a longer journey I want to present you my integration of PlayCanvas engine and VUE.js.
See my GitHub repo here:
And a live Demo on Netlify here:
https://playcanvas-vue.netlify.app/
This project is a Boilerplate to kick off your PlayCanvas Vue.js application.
I oriented myself on the Editor export so it is possible to alnost copy & past scene JSON
and config to kick off a project which has been developed in the Editor.
PlayCanvas scripts can be easily converted to VUE Mix…
1 Like