n5ro/aframe-physics-system

Cannot remove dynamic-body; TypeError: _bi2 is undefined

Eoczi opened this issue · 1 comments

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); } }); } });
<a-box id="remove" position="-2 4 -2" dynamic-body removedynamic></a-box>
Version of physics system:
`

<script src="https://cdn.jsdelivr.net/gh/c-frame/aframe-physics-system@v4.1.0/dist/aframe-physics-system.js"></script> <script src="https://unpkg.com/aframe-physics-extras/dist/aframe-physics-extras.min.js"></script>

`
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?

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