I'm trying to get Farseer working with Monotouch. I've built the latest Farseer code for use with Monotouch (only had to make one change -- replacing HashSet<T> with non-generic type).
I have one simple screen that contains two shapes: one dynamic Circle and one static EdgeShape. The idea is to just get the circle to bounce off the edge. This is working fine with one problem: the circle just won't go fast enough. It is
all very slow. I know the frame rate is not the problem -- it's smooth and showing about 120fs. I've tried tweaking gravity, applying an impulse, changing the step... all of which change the behavior, but none of which make the circle fall and
bounce with any sort of speed (takes a few seconds for the circle to bounce off the edge).
Also, I don't understand the argument to World.Step at all. I thought this was a measure of time. Changing it should change how much is moved in a step, but here's what I'm observing:
1. The lower the value sent to Step, the faster the ball moves (but never fast enough).
2. Increasing the value to Step changes the physics. Instead of bouncing off the edge the ball vibrates along the edge.
Please help. Here's some of the code:
private void CreateBody()
if (this.world == null)
this.world = new World(new Vector2(0, 100));
if (this.ballBody != null)
this.ballBody.FixtureList.AfterCollision -= AfterBallCollisionEventHandler;
this.ballBody = BodyFactory.CreateBody(this.world, new Vector2(Rand.Next(300), 0));
this.ballBody.BodyType = BodyType.Dynamic;
Vector2 impulseV = new Vector2(0, 100);
CircleShape cs = new CircleShape(10f, 0.5f);
Fixture fix = this.ballBody.CreateFixture(cs);
fix.Friction = 0;
fix.Restitution = 1f;
fix.AfterCollision += AfterBallCollisionEventHandler;
private void Start()
this.thread = new Thread(PlayThread as ThreadStart);
using(var pool = new NSAutoreleasePool())
Vector2 pos = this.ballBody.Position;
// reset the ball when it goes off screen
if (pos.Y > 520 || pos.X < -40 || pos.X > 360 || pos.Y < -40)