This project has moved. For the latest updates, please go here.

Threads in FP3.0

Topics: Developer Forum, User Forum
Sep 6, 2010 at 3:19 PM
Edited Sep 6, 2010 at 3:20 PM


sry but I have the next problem....:(

Due the bad performance on creating geometry objects in FB2.3 on the xbox360, I made a 2nd thread to load track parts while playing. But in FP3.0 you are not allowed to create bodies during callbacks. 

while (GameHelpfulGlobals.Instance.physicsSimulator.IsLocked)
ground.CreateFixture(shape, 1f); // WARNING: This function is locked during callbacks

I was thinking that this check solved the problem - but sometimes the game crashes too....
How can I create Fixtures in a 2nd thread? When does callbacks happen? only when the first thread is in the physicsSimulator.Step(...) function?

Thx again! and sry for my english, i am from austria...try to get better in it :)

Sep 7, 2010 at 8:07 AM

The checks are there to ensure a consistent and functional world during the time step. You will have to wait until the current step is done and then create the fixture.