I'm starting a game, and I'm using Farseer as the physics engine.
I have setup a few boxes acting as terrain tiles, and a box as the player. The collisions between these two are very weird, they intersect and slide when it's not a "direct" hit.
Here's a GIF of what's happening: http://i.imgur.com/HR0J0D3.gifv
And here are the snippets:
//Creating the body
PhysBody = BodyFactory.CreateRectangle(
Transform.World.PhysWorld,
ConvertUnits.ToSimUnits(Width * Transform.Scale),
ConvertUnits.ToSimUnits(Height * Transform.Scale),
5,
ConvertUnits.ToSimUnits(Transform.Position.ToVector2()));
//The tiles are static, the player is not
PhysBody.BodyType = Static ? BodyType.Static : BodyType.Dynamic;
//Drawing the test rectangles
ShapeRenderer.Instance.DrawRectangle(
sb,
ConvertUnits.ToDisplayUnits(PhysBody.Position).ToVector2(),
new Size2((int)(Width * Transform.Scale), (int)(Height * Transform.Scale)),
Color.White);
I don't think the rest is important, all I did was create a world with 9.8 gravity.
I have also tried without using Transform.Scale and with just one box below the player, and the problem still happens.
The graphics engine I'm using is Ultraviolet
Transform.Scale
is being applied correctly both to physics and rendering? – FusionTransform.Scale
was 0.5 or so, so that might be what you mean. – LighteningPhysBody.BodyType = Static ? ... : ...;
). Although I've used other physics engines, I'm not familiar with farseer so don't think I can help much. I did find someone else with a similar issue but no solution. – FusionStatic
in the class, so I want to set the body's type to that – Lightening