Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do I destroy an entity that has a body? #363

Open
evaogbe opened this issue Dec 25, 2020 · 0 comments
Open

How do I destroy an entity that has a body? #363

evaogbe opened this issue Dec 25, 2020 · 0 comments

Comments

@evaogbe
Copy link

evaogbe commented Dec 25, 2020

Whenever I try I get

TypeError: Cannot read property 'type' of undefined
    at scriptType.P2World.postUpdate (https://launch.playcanvas.com/api/assets/files/scripts/p2-integration.js?id=40361730&branchId=4ebfaa2e-923e-4ad2-b2e4-d10f0763f57d:170:19)
    at ScriptComponent._scriptMethod (https://code.playcanvas.com/playcanvas-stable.dbg.js:44702:19)
    at ScriptComponent._onPostUpdate (https://code.playcanvas.com/playcanvas-stable.dbg.js:44752:11)
    at ScriptComponentSystem._callComponentMethod (https://code.playcanvas.com/playcanvas-stable.dbg.js:45206:49)
    at ScriptComponentSystem._onPostUpdate (https://code.playcanvas.com/playcanvas-stable.dbg.js:45221:9)
    at Function._helper (https://code.playcanvas.com/playcanvas-stable.dbg.js:29284:12)
    at Function.postUpdate (https://code.playcanvas.com/playcanvas-stable.dbg.js:29304:9)
    at Application.update (https://code.playcanvas.com/playcanvas-stable.dbg.js:50241:20)
    at https://code.playcanvas.com/playcanvas-stable.dbg.js:50847:16

Here's my code to destroy the entity:

enemyBody.entity.destroy();

The body comes from a collision.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant