Oops Lockup in your code -> do this.

Dec 23, 2009 at 6:42 AM

Hi There,

I tried to include just the PhysicsComponent in my game and was getting the lock up on the BeginUpdate() call to the physics component.  I then read the other post where it mentioned that there is a dependency on drawing debug info through the IViewportComponent.  Since I want that I decided to add the IViewComponent to my game.  Still no dice...

After rereading the posts and a bit of experimentation I found that I have to do the following in the Game constructor or the Initialize() call.  If I do it in the LoadContent() call it is too late and it locks up.  What is the reason for that?

{{

viewpoint = new ViewpointComponent(this);
Components.Add(viewpoint);

physicsComponent = new PhysicsComponent(this, new GridCollisionSystem(20.0f));
Components.Add(physicsComponent);
}}
 
Thanks!
Dec 23, 2009 at 6:47 AM

D'oh!  A bit more experimentation reveals that manually calling Initialize() will make the code work from the LoadContent() method.