More accurate and reliable submarine-level collisions, looping OnUse sounds bugfix, new music clips, item sprites removed from limbs when someone else loots the item, Camera.WorldView fix, checking vector.LengthSquared before normalizing to avoid creating a NaN vector

This commit is contained in:
Regalis
2015-10-04 23:50:46 +03:00
parent 0be4ad4f84
commit f13a48ef52
33 changed files with 342 additions and 217 deletions

View File

@@ -401,14 +401,14 @@ namespace Subsurface
}
}
for (int i = 0; i < 2; i++)
{
Limb leg = (i == 0) ? rightFoot : leftFoot;
//for (int i = 0; i < 2; i++)
//{
// Limb leg = (i == 0) ? rightLeg : leftLeg;
if (leg.SimPosition.Y < torso.SimPosition.Y) continue;
// if (leg.SimPosition.Y < waist.SimPosition.Y) continue;
leg.body.ApplyTorque(-Dir * leg.Mass * 20.0f);
}
// //leg.body.ApplyTorque(Dir * leg.Mass * 50.0f);
//}
}
@@ -416,27 +416,17 @@ namespace Subsurface
{
movement = MathUtils.SmoothStep(movement, TargetMovement, movementLerp);
if (inWater && movement != Vector2.Zero)
if (inWater && movement.LengthSquared()>0.00001f)
{
movement = Vector2.Normalize(movement);
}
if (!MathUtils.IsValid(movement))
{
int a = 1;
}
RefLimb.pullJoint.Enabled = true;
RefLimb.pullJoint.WorldAnchorB =
RefLimb.SimPosition + movement*0.15f;
RefLimb.body.SmoothRotate(0.0f);
if (!MathUtils.IsValid(RefLimb.body.SimPosition))
{
int a = 1;
}
foreach (Limb l in Limbs)
{
if (l==RefLimb) continue;