Skip to content

[Ammo] Not all collision event fireing (issue with remove entities) #47

@smeybi

Description

@smeybi

When using ammo, and physics objects are removed, the collision event does not work properly anymore. There are dropouts in between.

If Ammo.destroy(this.body); is replaced by this.system.driver.removeBody(this.body); it works. with remove: element in line 16560

here is the whole element from line 16560:
remove: function() {
if (this.triMesh) Ammo.destroy(this.triMesh);
if (this.localScaling) Ammo.destroy(this.localScaling);
if (this.compoundShape) Ammo.destroy(this.compoundShape);
if (this.body) {
// Ammo.destroy(this.body);
this.system.driver.removeBody(this.body)
delete this.body;
}
Ammo.destroy(this.rbInfo);
Ammo.destroy(this.msTransform);
Ammo.destroy(this.motionState);
Ammo.destroy(this.localInertia);
Ammo.destroy(this.rotation);
},

For example it works, remove the ammo body and the object3D separate, not problem

document.querySelector('a-scene').systems.physics.driver.removeBody(e.target.body)
e.target.object3D.parent.remove(e.target.object3D)

i have reported this before here:
n5ro#137 (comment)

here is a new glitch to see the error:
(Comment out the new script 'aframe-physic-system-fix.js'
aframe-physic-system.js is the original.
perhaps increase the number and speed of boxes on powerful computers to see the error)
https://aframe-physics-system-remove-bug.glitch.me

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions