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
@@ -312,8 +312,12 @@ namespace Subsurface
//limb.body.ApplyTorque(limb.Mass * -20.0f * character.animController.Dir * dir);
}
limb.body.ApplyLinearImpulse(limb.Mass * 10.0f *
Vector2.Normalize(attackPosition - limb.SimPosition));
Vector2 diff = attackPosition - limb.SimPosition;
if (diff.LengthSquared() > 0.00001f)
{
limb.body.ApplyLinearImpulse(limb.Mass * 10.0f *
Vector2.Normalize(attackPosition - limb.SimPosition));
}
steeringManager.SteeringSeek(attackPosition + (limb.SimPosition-Position), 5.0f);
@@ -64,6 +64,9 @@ namespace Subsurface
private Vector2 DoSteeringSeek(Vector2 target, float speed = 1.0f)
{
Vector2 targetVel = target - host.Position;
if (targetVel.LengthSquared() < 0.00001f) return Vector2.Zero;
targetVel = Vector2.Normalize(targetVel) * speed;
Vector2 newSteering = targetVel - host.Steering;