Physics objects acting funky in WP7.1 apps

Feb 19, 2012 at 2:40 AM

I am just putting this out there for a general statement and hope maybe someone might have some insight.

I have built several games using the physics helper api and they have worked very successfully. All objects moved the way I wanted and it took little effect to get objects to behave correctly (despite a stray bullet flying through a wall sometime).

Ever since the API was updated for mango I cannot seem to get anything to work right.

I migrated some code from an old working application running on wp7 to wp7.1. AS soon as i did the physics started acting funky. Objects were moving much slower then they did before, any type of impact fast or slow would cause the two objects to be joined (crushed even) into one another never to be separated again and bullets would fly through anything and everything with relatively little speed.

Nothing in the design of my application had changed, they only change was moving to a mango solution and updating the physics helper api to the newest build.

For the application(s) mentioned above I was able to do things to get the world to work better by doing bitmap caching and doing the dance with the physicscontroller iterations and time stamps, but nothing I did made it work as well as it had when using the build for wp7. (Sorry for not remember the exact PH build numbers).

Now, the reason I am writing this, I am attempting to build a simple game, it uses the physics helper API, and in its current for it is simply a square block inside a physics controller with 4 walls.

I use the following code:

if (phy.Simulator != null)

               {

                   phy.Simulator.Gravity.Y = 5 * -sensor.CurrentValue.Acceleration.Y;

                   phy.Simulator.Gravity.X = 5 * sensor.CurrentValue.Acceleration.X; 

               }

to update the gravity of the "world" based on the accelerometer, I.E. the square sprite moves based on the accelerometer.

 

Whenever the block hit one of the four walls it gets stuck to said wall unless moving at snail speeds (and I really mean slow).

I have tried to add to the restitution coefficient to make the object bouncy, still sticks

I have tried marking all objects mentioned as "IsBullet", still sticks.

and I also tried to add bitmapcaching to all objects involved. Still no luck.

 

Now I am faced with an issue, the API for physics helper (which is amazing, and very generously shared with us) just isn’t working

correctly (for me) anymore and I don’t know how to fix the issue.

 

I have notice no one else has mentioned these issue on previous post, which leads me to believe it is not a wide spread issue.

 

If i could find a way to make the physics controller behave like it did in previous version I would be ecstatic.

 

Coordinator
Feb 20, 2012 at 11:17 AM

I'm traveling right now and don't have a code sample to post but... Could you try putting debugmode to true on the physicscontroller to check boundaries? Also what happens if you comment out the gravity change? Maybe gravity value is too high?