JiglibX addition to existing project questions

Posted by SomeXnaChump on Game Development See other posts from Game Development or by SomeXnaChump
Published on 2011-05-31T09:05:53Z Indexed on 2012/06/25 21:25 UTC
Read the original article Hit count: 228

Filed under:
|
|
|

Got a very simple existing project, that basically contains a lot of cubes. Now I am wanting to add a physics system to it and JiglibX seemed like the simplest one with some tutorials out there.

My main problem is that the physics don't seem to be working how I imagined, I expected my tower of cubes to come crashing down, but they dont seem to do anything.

I think my problem is that my cubes do not inherit DrawableGameComponent, they are managed by a world object that will update and render them. So they are at no point put into the games component list. I am not sure if this means that JiglibX will not be able to interact with them as in all the tutorials there are no explicit calls to add the Body objects to the physics system, so I can only presume that they are using a static/singleton under the hood which automatically hooks in all things, or they use the game objects component list somehow.

I also noticed that in alot of the tutorials they use the following when setting up the physics system:

float timeStep = (float)gameTime.ElapsedGameTime.Ticks / TimeSpan.TicksPerSecond;
PhysicsSystem.CurrentPhysicsSystem.Integrate(timeStep);

Would it not be better to keep a local instance of the created PhysicsSystem object and just call myPhysicsSystem.Integrate(timeStep)?

© Game Development or respective owner

Related posts about XNA

Related posts about xna-4.0