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

Problems switching from FP2 to FP3

Topics: Developer Forum, User Forum
Jul 18, 2010 at 2:30 PM
Following on from this thread here: I have began switching the code over to FP3. I have a few problems already though :( I couldn't find any documentation and the examples that you get when you sync up to the repository are clearly not finished yet. But picking through the code I could see that I would need to: - Change all the namespaces - Use a "World" instead of a PhysicsSimulator - Use Fixtures Maybe this is where I have gone wrong because I have a feeling I'm using the wrong code for my needs ... anyway, I have switched the code over for one screen only at the moment whilst leaving the rest running on FP2. On my new screen I added objects in this way ..... m_StartBoxFixture = FixtureFactory.CreateRectangle(physicsSimulator, 254, 130, 1, new Vector2(331, 278)); m_StartBoxFixture.Body.BodyType = BodyType.Dynamic; Effectively positioning them and giving them a size in one line. The code compliles, runs and looks similar to the original only a few strange things now happen. Firstly, my falling boxes appear to attract to one another a little. I do not wish for this to happen is there a way of turning this off. Secondly, the gravity vector i pass to the Wolrd object when i instantiate it appears to have no effect (having gravity set to (0,40) seems no different than (0,5000)), all the falling boxes, fall a little slowly. Not sure how to rectify that problem. Finally, and probably more importantly, after two or three collisions between boxes the engine throws a null exception. It's in the Collide function on ContactManager.cs. Line 240 "Fixture fixtureA = c.FixtureA;" one of the fixtures appears to be null. Any help on how to progress would be very much appreciated.
Jul 18, 2010 at 3:38 PM
The testbed project in the source is a full set of examples ported straight from box2d. That's what you want to check out. Give that a try and see where it takes you.
Jul 18, 2010 at 4:03 PM
Yeah I'm in there at the moment. Every test i try from the testbed throws a null reference exception in the collide function. The same as how my game is currently
Jul 18, 2010 at 4:11 PM
For example. If you sync to the latest revision, then run test 3, a stacked boxes text. Boom, exception throws about 4 seconds into it. With any other test you have to at least move something a bit first. Should i be syncing to a different revision maybe?
Jul 18, 2010 at 4:15 PM
Ignore that! Just went back a revision and also noticed latest revision has a label on it "do not download not working"
Jul 18, 2010 at 9:27 PM

Doh!  Thanks for the heads up.  I grabbed FP3, but don't keep it updated, so I didn't know about the breaking change.