in our application we are trying to change Aframe with cannon to aframe with ammo.
We get load the model well by this way:
First loading the model then the ammo-body.
When the model is loaded, the event loads ammo-shape (the collison mesh) and then when the body is loaded we set the restitution.
const gltfmodel = document.getElementById(this.data.id)
gltfmodel.setAttribute('gltf-model', this.data.model)
gltfmodel.setAttribute('shadow', {receive: false})
// Specify what type of ammo-body (dynamic, static, kinematic)
gltfmodel.setAttribute('ammo-body', {type: this.data.body})
// Waiting for model to load before adding ammo-shape (box, cylinder, sphere, capsule, cone, hull)
gltfmodel.addEventListener('model-loaded', () => {
gltfmodel.setAttribute('ammo-shape', {type: this.data.shape,
fit: this.data.fit,
halfExtents: this.data.halfExtents,
offset: this.data.offset})
});
gltfmodel.addEventListener('body-loaded', () => {
try {
var sceneEl = document.querySelector('a-scene');
//Set robot restitution
sceneEl.querySelector("#"+toString(this.data.id)).body.setRestitution(this.data.restitution);
//Set a-plane restitution
sceneEl.querySelector("#a-plane").body.setRestitution(0.8);
} catch (e) {}
}
})
It works really well in Firefox but the body-loaded event doesn't work quite right for Chrome. This event 'body-loaded' is not picked up properly in chrome, do you have any idea what could be happening?
Hello!!
in our application we are trying to change Aframe with cannon to aframe with ammo.
We get load the model well by this way:
First loading the model then the ammo-body. When the model is loaded, the event loads ammo-shape (the collison mesh) and then when the body is loaded we set the restitution.
It works really well in Firefox but the body-loaded event doesn't work quite right for Chrome. This event 'body-loaded' is not picked up properly in chrome, do you have any idea what could be happening?