n5ro / aframe-physics-system

Physics system for A-Frame VR, built on CANNON.js.
https://n5ro.github.io/aframe-physics-system/
MIT License
505 stars 136 forks source link

Cannot remove dynamic-body; TypeError: _bi2 is undefined #208

Closed Eoczi closed 3 months ago

Eoczi commented 3 months ago

I have the following entity that has the 'removedynamic' component:

AFRAME.registerComponent('removedynamic', { init: function() { var el = this.el; el.addEventListener('collide', function collision (event) { var collidedEntity = event.detail.body.el; if (collidedEntity.id == '#fruit'){ el.removeAttribute('dynamic-body'); el.removeEventListener('collide', collision); } }); } }); `

Version of physics system:

` Whenever I try to remove the dynamic-body component i get the error TypeError: _bi2 is undefined and the app crashes(white screen). Sometimes the app doesn't crash but the error still appears and i believe(from testing) it's based on what type of body the entity collides with first (static or dynamic). Is this supposed to happen? If yes, is there a workaround to this?

vincentfretin commented 3 months ago

@n5ro can you please archive this repository @Eoczi please test with the latest version at https://github.com/c-frame/aframe-physics-system