Trying To Get Circles To Roll

Topics: Developer Forum, User Forum
Jul 5, 2009 at 10:29 AM

My problem is that i can't seem to get my charictor (a circle) to roll around properly

I have gotten his jumping working fine
But when he rolls around he jumps as if he is hitting something :(

http://www.youtube.com/watch?v=1yI1gMW3vpE

heres a link that shows the problem

 

Now i know this is most likely because the circles in farsser are just an aproximation of a circle, but regardless is there any tweeks i can do to reduce the problem?
Also i remember seeing somewhere a post about farseer haveing a patch or someone working on real circles.

Also here are the "stats" i use for the geom and body creation

            Body = BodyFactory.Instance.CreateCircleBody(g_TouchMeZone.GET.physicsSimulator, 32, 5);
            Geom = GeomFactory.Instance.CreateCircleGeom(g_TouchMeZone.GET.physicsSimulator, Body, 32, 32, 0);
            Body.Position = new Vector2(200, 637);
            Body.Tag = this;
            Geom.FrictionCoefficient = 0.3f;
            Geom.RestitutionCoefficient = 0.2f;
            Geom.OnCollision += OnPlayerCollision;

            BodySensor = BodyFactory.Instance.CreateCircleBody(g_TouchMeZone.GET.physicsSimulator, 40, 1);
            GeomSensor = GeomFactory.Instance.CreateCircleGeom(g_TouchMeZone.GET.physicsSimulator, BodySensor, 32, 40, 0);
            BodySensor.Position = new Vector2(200, 637);
            BodySensor.Tag = this;
            GeomSensor.OnCollision += OnSensorCollision;

also on another note i have found that the sensor i am trying to make here just wont work and even thou i put it into the simulator it just isnt there (the bod and geo count go up in the PhysicsSimulatorView however)


Any help on eather of these problems would be great.

Coordinator
Jul 5, 2009 at 2:47 PM

You said it yourself: Circles are an approximation of a circle. The main problem with this is that you won't get 100% correct behavior when circles bounce around. It can be tweaked a little by adding more points on the circle so that it approximate a real circle a little more accurate. You could also remove rotation and make the circle fixed. You can still simulate that the circle rotate by rotating the texture.

This will make the circle rotate more smooth, but it can also cause other problems. It is a bout finding a compromise or creating a mechanism that switches from fixed to rotation whenever it is needed.
Real circles has not been implemented into FPE. It will come in 3.0 tho, so you just have to wait a bit.

As for the sensor, you need to set the IsSensor property to true.