Quick question about revolute joints.
I have a revolute joint to which rotates one body around another using the motor based on the position of your cursor. The problem is the further away the satellite body is the more the joint seems to wobble. So if I have the satellite body close
to the other body it rotates perfectly based on the cursor position, when I move it further away it spasms.
Is there a way to stop that? This is my rotation code:
float rotation = (float)Math.Atan2(position.Y - _body.Position.Y, position.X - _body.Position.X);
float angleError = _joint.JointAngle + rotation;
if (angleError <= -3.14159265f)
angleError += 6.28318531f;
if (angleError >= 3.14159265f)
angleError -= 6.28318531f;
float gain = 10.0f;
_joint.MotorSpeed = (-gain * angleError);