More Box2D integration

Published June 06, 2010
Advertisement
More Box2D integration
Continued from here.
Been busting may ass off for two days integrating Box2D into the Citizen engine. For most parts it's been successful. Although Box2D is very simple to get working, there are hundreds of small connections that need to be welded together.

The biggest incision I've had to make so far is to create a logical coordinate system separate from the pixels-units I have been using. This is also what's taken most of the time.

Using logical units has been one of those things I knew from the start I should do but then never got around to implement. Now, a hundred little sins later, the pixel units were so deeply rooted into the system that in weeding them out I had to review most of the graphics code and then some. *groan*

At the time of typing all things render correctly but sizes are way off and need to be recalibrated in with new numbers. Box2D interactions work fine with all different object types. I mentioned before how entity hierarchies had to be scrapped in newer versions of the system. By using hinge joints I've re-enabled the option to attach one object to another, which currently is used for ship turrets, and now such attachments are physically accurate.

The next big issue is that the behaviors that control movement need to be adapted to the new physics. What was done before by controlling the velocity of actors directly now have to be done using forces, so some control theory might be appropriate to avoid oscillations.

I've also beaten out the last dents in the property container so the next entry will be going into all of its details, source included. I could do it now but I'm too tired to write proper documentation. Got to get up early tomorrow. See you back here soon.
0 likes 0 comments

Comments

Nobody has left a comment. You can be the first!
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement
Advertisement