Strange collision behavior in 3.0

Jul 6, 2010 at 9:26 PM
Edited Jul 6, 2010 at 9:34 PM
Hey there, I'm porting a game over from 2.1.3 and I can't figure out what's causing some strange collision behavior. Basically, I've created a set of bodies and move them on a circular path. Here's a video of the behavior. Anyone have any ideas? Thanks.
Jul 6, 2010 at 10:29 PM

What scale are you using? Bodies in 3.x need to be in meters, kilograms, and seconds. Also, how are you moving the bodies on the circular path? Are they Kinematic? Are you simply changing the Position property or setting the linear velocity? Answer these questions and I can solve your problem.


Jul 6, 2010 at 10:46 PM
Edited Jul 6, 2010 at 10:53 PM

Hey Matt, Thanks for the reply. I'm scaling via oranjoose's example found here. My bodies are static (though I tried Kinematic with similar results) and are updated via Position property.

 foreach (GameObject peg in pegList)


 peg.objectBody.Position = StoW(new Vector2(peg.pointOfOrigin.X + peg.radius * (float)Math.Cos(MathHelper.ToRadians(angle + peg.initialAngle)), peg.pointOfOrigin.Y + peg.radius * (float)Math.Sin(MathHelper.ToRadians(angle + peg.initialAngle))));


 Collisions work perfectly in 2.1.3. Can't figure it out.

ughh. I can't format or hyperlink in these forums. Sorry.

Jul 7, 2010 at 1:46 AM
Hey Scero, Your problem is you must move bodies with velocity only for proper physics reactions in 3.x. Also making the bodies Kinematic will stop them from drifting due to gravity. I know it sucks to have to use velocity but that's how it is. Hear is an example of how to find the velocity to move your body to a certain position. Physics Sorry, can't hyperlink right now. You'll have to copy/paste. Matt
Jul 7, 2010 at 2:14 AM
Yeah, it's going to take a bit of work to move them with velocity. I'm going to take a look at the example and see if I can figure this out. Thanks for your help.