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

Stacktrace with newer version 4.1.0 #177

Closed
ia97lies opened this issue Feb 5, 2021 · 4 comments · Fixed by #178
Closed

Stacktrace with newer version 4.1.0 #177

ia97lies opened this issue Feb 5, 2021 · 4 comments · Fixed by #178
Labels
bug A confirmed bug that is planned to be fixed
Milestone

Comments

@ia97lies
Copy link

ia97lies commented Feb 5, 2021

My system updated to dyn4j to version: 4.1.0. If I remove a item (I shot the enemy in this case :D) it leads to the following error (the older version didn't had that problem):

Feb 05, 2021 6:58:16 PM com.jme3.app.LegacyApplication handleError
SEVERE: Uncaught exception thrown in Thread[jME3 Main,5,main]
java.lang.IllegalStateException
at java.util.LinkedHashMap$LinkedHashIterator.remove(LinkedHashMap.java:730)
at org.dyn4j.world.AbstractPhysicsWorld.solveTOI(AbstractPhysicsWorld.java:1400)
at org.dyn4j.world.AbstractPhysicsWorld.step(AbstractPhysicsWorld.java:1269)
at org.dyn4j.world.AbstractPhysicsWorld.update(AbstractPhysicsWorld.java:285)
at org.dyn4j.world.AbstractPhysicsWorld.update(AbstractPhysicsWorld.java:247)
at ch.artificials.bubble.system.dyn4j.Dyn4jPhysicsSystem.update(Dyn4jPhysicsSystem.java:297)
at com.jme3.app.state.AppStateManager.update(AppStateManager.java:356)
at com.jme3.app.SimpleApplication.update(SimpleApplication.java:255)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.runLoop(LwjglAbstractDisplay.java:151)
at com.jme3.system.lwjgl.LwjglDisplay.runLoop(LwjglDisplay.java:197)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:232)
at java.lang.Thread.run(Thread.java:748)

Any idea what I have to change or adapt. I also saw that body.setActive(true) does not exist anymore.

@wnbittle
Copy link
Member

wnbittle commented Feb 5, 2021

How/when are you removing the enemy? That error is emitted at the point where we're checking if two bodies are still overlapping wrt. their swept AABBs. It could also reach that branch of code if either body didn't exist in the CCD broadphase any more (i.e. being removed).

For Body.setActive(boolean), I think the replacement is Body.setEnabled(boolean). What version are you coming from?

@wnbittle wnbittle added the triage A reported bug that has not been confirmed yet label Feb 5, 2021
@ia97lies
Copy link
Author

ia97lies commented Feb 8, 2021

I remove the objects simply like this:

protected void removeDyn4jBody(final Dyn4jBody body, final Entity entity) {
    bodyCache.remove(entity.getId());
    world.removeBody(body);
}

I just remove it from the physic world.

I went back to version 4.0.2, so just back to the last version.

@wnbittle wnbittle added bug A confirmed bug that is planned to be fixed and removed triage A reported bug that has not been confirmed yet labels Feb 8, 2021
@wnbittle wnbittle added this to the 4.1.1 milestone Feb 8, 2021
@wnbittle
Copy link
Member

wnbittle commented Feb 8, 2021

Thanks for the additional details - I think I found the issue. Let me replicate with a unit test and I'll get an update out this evening (ET).

@wnbittle wnbittle linked a pull request Feb 8, 2021 that will close this issue
@ia97lies
Copy link
Author

ia97lies commented Feb 9, 2021

Thanks a lot :) that was quick!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A confirmed bug that is planned to be fixed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants