Code Funnies

Sep 16, 2011 at 12:05 PM

I'm in the process of moving my Farseer physics code into the same structure as your BEPU Physics code (ie implementing it as a Sunburn collision manager) and noticed a small issue with some of the code...not really worthy of a bug since it would work as is...

public void BeginFrameRendering(ISceneState scenestate)        {       
if(Space.ForceUpdater.Gravity.Y != scenestate.Environment.Gravity)
Space.ForceUpdater.Gravity = new Vector3(0, -scenestate.Environment.Gravity, 0);       
}

This will work but the if statement will always return true and the gravity will be reset every frame since you compare with Gravity and then set to -Gravity.

Coordinator
Sep 19, 2011 at 10:00 AM

Hi bamyazi,

You're right on the if statement, I made a simple sign mistake that will get fixed on next release. Thanks for sharing this ;)

Regards

Coordinator
Sep 19, 2011 at 10:02 AM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.