Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (780)
Games in Android Showcase (233)
games submitted by our members
Games in WIP (857)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  [SOLVED][LibGDX] Problem with removing and creating Bodies  (Read 1195 times)
0 Members and 1 Guest are viewing this topic.
Offline sirkarpfen

Junior Devvie

Medals: 2
Exp: 2 years

« Posted 2013-08-15 18:14:43 »

I really didn't find any suitable solution on the web for my particular problem.

I'm creating a game with LibGDX and run into problems when i try to create bodies. The Problem occurs quite randomly and i can't track it down properly, but it seems it is only occuring when i create an Item from my Item class.

This is the error message:

and this is the logfile created:

As i read on some resources it seems like this error is caused when destroying a body while iterating over the bodylist. As i do not destroy bodies when this error happens its seems rather odd. Also i never figured out why the OpenAL library is involved here, as i don't use any sounds yet...
Offline sirkarpfen

Junior Devvie

Medals: 2
Exp: 2 years

« Reply #1 - Posted 2013-08-17 18:14:37 »

I just found the solution to this problem. As allways it was pretty obvious but the error was not  Tongue.

Previously i just flagged my entities for destruction and then iterated over them to destroy the bodies. This worked fine but the Problem was with the creation of the bodies (obviously doing that when the world was stepping).

The solution was, that i now add my entities to a list when they need to be created/destroyed. I create them before the step happens, and destroy them after the step finished.


It was kinda hard to find the solution, as it's only mentioned with 1 sentence at the end here:

"By the way, although this topic has focused on removing bodies since that is the most common case to cause problems, the creation of new bodies, and the creation and removal of fixtures must be dealt with in the same way."
Pages: [1]
  ignore  |  Print  

hadezbladez (745 views)
2018-11-16 13:46:03

hadezbladez (383 views)
2018-11-16 13:41:33

hadezbladez (735 views)
2018-11-16 13:35:35

hadezbladez (194 views)
2018-11-16 13:32:03

EgonOlsen (2393 views)
2018-06-10 19:43:48

EgonOlsen (2556 views)
2018-06-10 19:43:44

EgonOlsen (1482 views)
2018-06-10 19:43:20

DesertCoockie (2145 views)
2018-05-13 18:23:11

nelsongames (1949 views)
2018-04-24 18:15:36

nelsongames (2629 views)
2018-04-24 18:14:32
Deployment and Packaging
by mudlee
2018-08-22 18:09:50

Java Gaming Resources
by gouessej
2018-08-22 08:19:41

Deployment and Packaging
by gouessej
2018-08-22 08:04:08

Deployment and Packaging
by gouessej
2018-08-22 08:03:45

Deployment and Packaging
by philfrei
2018-08-20 02:33:38

Deployment and Packaging
by philfrei
2018-08-20 02:29:55

Deployment and Packaging
by philfrei
2018-08-19 23:56:20

Deployment and Packaging
by philfrei
2018-08-19 23:54:46 is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!