I'm trying to catch collision event between a dynamic sphere and a static gltf model. I'm building the gltf entity the following way:
const template = document.createElement('a-entity');
template.setAttribute('physics-collider', 'ignoreSleep: false');
template.setAttribute('collision-filter', 'collisionForces: false');
template.setAttribute('body', 'type:static; shape:hull');
// add position, scale, url etc
// ...
template.addEventListener('collisions', e => {
// debugger;
})
This code creates an entity, but there is no wire net around it in debug mode and the collisions
event is not being fired.
For debug purposes I tried different shapes. This creates a cylinder around the entity, but it seems too big. The dynamic shape crosses the cylinder, but the collisions
event is being fired not always, rather rare.
template.setAttribute('body', 'type:static; shape:cylinder');
Then I tried to build the shape manually:
template.setAttribute('body', 'type:static; shape:none');
template.setAttribute('shape', 'shape: cylinder; height: 5;');
In this case I'm getting the following error:
Cannot read property 'bodyOverlapKeeper' of null at NewComponent.<anonymous> (physics-collider.js:34)
So now I'm stuck. Could someone advice what I'm doing wrong. I'd like to use the shape of the gltf model itself. I opened it in blender, but it seems okay, I don't understand why shape:hull
doesn't work.
P. S. : if it matters, I'm using webpack