-
Notifications
You must be signed in to change notification settings - Fork 137
Ammo: Not all entities/bodies remove on collision event (issue with remove entities) #137
Comments
When using AmmoDriver, removing objects with removeChild will prevent "collidestart" and "collideend" of the remaining objects. (edit) post new issue |
Try after a long time, I found out, it has a problem with deleting the ammo body on remove the entity (with ammo physics). I recreated and combined it with three.js. It work until remove the entity. For example it works, remove the ammo body and the object3D separate, not problem But remove the entity there were the dropouts again. I figured out, if this Ammo.destroy(this.body) is exchanged with the this.system.driver.removeBody(this.body) in the script for the Ammo remove function, it works. I don't know if this causes problems anywhere else! aframe-physics-system.js Line 14912: remove: function() { |
Legend figuring that out and posting it! Was banging my head for days trying to figure out why that was happening :) |
Is there any progress pls? |
Hi,
I noticed something, I'm not sure if it's a issue, maybe I'll remove entities the wrong way.
I would like to remove entities at collision. The collide events work, but if i use this for removeChild, not all entities are removed. It's look like a rhythm, a few are skipped.
This is the collision event code:
this.el.addEventListener('collidestart', function(e) {
if (remove_e) {
e.target.parentNode.removeChild(e.target);
} else {
e.target.setAttribute('color', "blue");
}
Here is a example (only collisions with static bodies) on glitch, when a button is pressed, it will change to remove entity or color change:
https://glitch.com/edit/#!/aframe-physics-ammo2
The same example with dynamic bodies it works, but I think it works, because there are many collisions events, that finally remove the entity.
https://glitch.com/edit/#!/aframe-physics-ammo1
Edit: The same issue is when removing entities direct, not on the collision event. The collisions events skip some entities.
The text was updated successfully, but these errors were encountered: