This project has moved and is read-only. For the latest updates, please go here.

Abnormal behavior from AngleJoint

Mar 25, 2009 at 6:03 AM
Edited Mar 25, 2009 at 11:51 AM
I'm just trying to set dynamic target angles on an anglejoint. I am alternating between 0 and 45 degrees. However, the actual rotation on my model is around 5 degrees. I would really appreciate some help. This was only a recent problem. Earlier the issue was while it was rotating the full amount, it rotated VERY slowly, no matter the max impulse I put in (10.0f - 10000.0f). It bears mentioning that the class this is all written in is a gutted version of Demo1Screen.


            _rectangleBody = BodyFactory.Instance.CreateRectangleBody(PhysicsSimulator, 256, 64, 1);
            _rectangleBody.Position = _origin;
            _rectangleGeom = GeomFactory.Instance.CreateRectangleGeom(PhysicsSimulator,_rectangleBody, 256,
            _rectangleGeom.RestitutionCoefficient = .4f;

            _pivotBody = BodyFactory.Instance.CreateCircleBody(PhysicsSimulator,20, 1);
            _pivotBody.Position = _origin;

            JointFactory.Instance.CreateRevoluteJoint(PhysicsSimulator, _pivotBody, _rectangleBody, _rectangleBody.Position);
            _pivotJoint = JointFactory.Instance.CreateAngleJoint(PhysicsSimulator, _pivotBody, _rectangleBody);

            _pivotJoint.TargetAngle = 0.0f;
            _paddleRotated = false;


            Vector2 force = 3000 * input.CurrentGamePadState.ThumbSticks.Left;
            force.Y = -force.Y;

            if (input.LastGamePadState.Buttons.B != ButtonState.Pressed && input.CurrentGamePadState.Buttons.B == ButtonState.Pressed)

            if (input.LastGamePadState.Buttons.A != ButtonState.Pressed && input.CurrentGamePadState.Buttons.A == ButtonState.Pressed)
                _paddleRotated = !_paddleRotated;

            if (_paddleRotated)
                _pivotJoint.TargetAngle = MathHelper.ToRadians(45);
                _pivotJoint.TargetAngle = 0.0f;

I know this is hacky and inefficient, I'm really just trying to get a handle on the engine. This is very frustrating, because I know it's something stupid I've done wrong. Feel free to berate me after telling me my idiotic mistake.