Rotation Issue

Topics: Developer Forum
Jul 14, 2012 at 3:48 PM

I'm making a game where the player controls a circle and rotates it around a fixed revolute joint in the middle of the screen.  However, when I apply angular impulse to it it seems to wobble when it should just rotate around that joint and shouldn't move.  Does anyone know why this happens? 

I've tried creating a body from a circular texture and I've also tried creating a body like it shows in the TestBed XNA but they both wobble when I rotate the body. 

Jul 15, 2012 at 12:57 PM

If the circle isn't in the middle of the screen (on top of the revolute joint), it will just orbit the joint.

If you want the circle to rotate in place, you need to put the joint at its centre of mass.

Jul 15, 2012 at 2:58 PM
Edited Jul 16, 2012 at 1:45 AM

I thought I was doing that, but maybe I have been doing it wrong.  I placed the circles center at 240, 400 on the screen.  When we define a joint in farseer is it on a pixel big or is it larger than that?  I even resized my image thinking that a join was only a pixel bit and made sure I put the joint in the center of the image and it still wobbled.  After that didn't work I tried defining a circle without a image just like the testbed xna does it and it still wobbles.   

I've tried this:

            CircleShape shape = new CircleShape(1.3f, 1f);
            _circle = BodyFactory.CreateBody(world);
            _circle.Position = new Vector2(2.4f, 4.0f);
            _circle.BodyType = BodyType.Dynamic;
            _circle.CollidesWith = Category.None;
            _circle.CollisionCategories = Category.Cat31;

which is from the testbed but it still wobbles. 

Any suggestions?

Jul 16, 2012 at 8:32 AM

OK... erm...

Is the texture off-centre? Have you tried using DebugView to check?

Jul 16, 2012 at 11:53 AM

I figured it out.  The texture was the one off center.  Now it's not wobbling.  Thanks.