Nov 24, 2012 at 2:44 AM
Edited Nov 24, 2012 at 2:46 AM
I'm trying to make two bodies rotate to the same angle as the player pushes the right thumbstick.
ship.Rotation = (float)System.Math.Atan2(input.GamePadState.ThumbSticks.Right.X, input.GamePadState.ThumbSticks.Right.Y);
Which works PERFECTLY.
HOWEVER why I try to add in the shield which I currently link to the ship via a distance and angular joint. And apply the (float)System.Math.Atan2(input.GamePadState.ThumbSticks.Right.X, input.GamePadState.ThumbSticks.Right.Y);
to just the ships rotation then the ship is fine but the shield rotates very slowy.
If I apply the rotation to just the shield the shield is find but the ship bounces around alot.
if I apply the rotation to both the ship and shield they are both fine EXCEPT they BOTH boune around ALOT. I'm not sure how to fix this.
Any suggestions would be creatly appreciated.
Both the ship and shield are compound polys read in from the textures.
collision is turned off between the ship and sheild.
const float dampingRatio = 1f;
const float frequency = 25f;
JointFactory.CreateAngleJoint(World, ship, shield);
DistanceJoint ShieldLink = new DistanceJoint(ship, shield, new Vector2(0f, 0f), new Vector2(0f, (2*GameSettings.Default.Scale)));
ShieldLink.CollideConnected = false;
ShieldLink.DampingRatio = dampingRatio;
ShieldLink.Frequency = frequency;
ShieldLink.Length = 0;
I would love to do this with applylinear impulse but that just seemed to make them into pendulem.
Again i want to have the ship faceing one way. the player pushed up and right on the thumbstick then the ship and shield both face up and right with no bouncing.
I also tried just using one body and attaching both as fixtures but i cant seem to use any offset since both are compound and they end up just ploping one on top of the other. Plus this may have issues later when I want to make it so collision passes
though the shield when it doesnt have power and hits the ship.