Doors push colliders away when closing, small human standing anim tweak
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
|
||||
<name firstname="Content/Characters/Human/[GENDER]firstnames.txt" lastname="Content/Characters/Human/lastnames.txt" />
|
||||
|
||||
<ragdoll headposition="154" torsoposition="118"
|
||||
<ragdoll headposition="154" torsoposition="115"
|
||||
stepsize="42.0, 12.0"
|
||||
walkanimspeed="4.58"
|
||||
movementlerp="0.4"
|
||||
|
||||
@@ -318,17 +318,12 @@ namespace Barotrauma
|
||||
Collider.LinearVelocity.Y > 0.0f ? Collider.LinearVelocity.Y * 0.5f : Collider.LinearVelocity.Y);
|
||||
}
|
||||
|
||||
//ClimbOverObstacles();
|
||||
|
||||
getUpSpeed = getUpSpeed * Math.Max(head.SimPosition.Y - colliderPos.Y, 0.5f);
|
||||
|
||||
torso.pullJoint.Enabled = true;
|
||||
head.pullJoint.Enabled = true;
|
||||
waist.pullJoint.Enabled = true;
|
||||
|
||||
Collider.FarseerBody.Friction = 0.05f;
|
||||
Collider.FarseerBody.Restitution = 0.05f;
|
||||
|
||||
if (stairs != null)
|
||||
{
|
||||
torso.pullJoint.WorldAnchorB = new Vector2(
|
||||
@@ -447,9 +442,19 @@ namespace Barotrauma
|
||||
|
||||
for (int i = -1; i < 2; i += 2)
|
||||
{
|
||||
Vector2 footPos = new Vector2(
|
||||
Crouching ? waist.SimPosition.X + Math.Sign(stepSize.X * i) * Dir * 0.3f : GetCenterOfMass().X,
|
||||
colliderPos.Y - 0.1f);
|
||||
Vector2 footPos = colliderPos;
|
||||
|
||||
if (Crouching)
|
||||
{
|
||||
footPos = new Vector2(
|
||||
waist.SimPosition.X + Math.Sign(stepSize.X * i) * Dir * 0.3f,
|
||||
colliderPos.Y - 0.1f);
|
||||
}
|
||||
else
|
||||
{
|
||||
footPos = new Vector2(GetCenterOfMass().X + stepSize.X * i * 0.2f, colliderPos.Y - 0.1f);
|
||||
}
|
||||
|
||||
|
||||
var foot = i == -1 ? rightFoot : leftFoot;
|
||||
|
||||
|
||||
@@ -328,6 +328,9 @@ namespace Barotrauma
|
||||
break;
|
||||
case "collider":
|
||||
collider.Add(new PhysicsBody(subElement, scale));
|
||||
|
||||
collider[collider.Count - 1].FarseerBody.Friction = 0.05f;
|
||||
collider[collider.Count - 1].FarseerBody.Restitution = 0.05f;
|
||||
collider[collider.Count - 1].FarseerBody.FixedRotation = true;
|
||||
collider[collider.Count - 1].CollisionCategories = Physics.CollisionCharacter;
|
||||
collider[collider.Count - 1].FarseerBody.AngularDamping = 5.0f;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Xml.Linq;
|
||||
using FarseerPhysics;
|
||||
using FarseerPhysics.Dynamics;
|
||||
@@ -7,6 +8,7 @@ using FarseerPhysics.Factories;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Barotrauma.Lights;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Barotrauma.Items.Components
|
||||
{
|
||||
@@ -409,50 +411,53 @@ namespace Barotrauma.Items.Components
|
||||
{
|
||||
int dir = isHorizontal ? Math.Sign(c.SimPosition.Y - item.SimPosition.Y) : Math.Sign(c.SimPosition.X - item.SimPosition.X);
|
||||
|
||||
foreach (Limb l in c.AnimController.Limbs)
|
||||
List<PhysicsBody> bodies = c.AnimController.Limbs.Select(l => l.body).ToList();
|
||||
bodies.Add(c.AnimController.Collider);
|
||||
|
||||
foreach (PhysicsBody body in bodies)
|
||||
{
|
||||
float diff = 0.0f;
|
||||
|
||||
if (isHorizontal)
|
||||
{
|
||||
if (l.SimPosition.X < simPos.X || l.SimPosition.X > simPos.X + simSize.X) continue;
|
||||
if (body.SimPosition.X < simPos.X || body.SimPosition.X > simPos.X + simSize.X) continue;
|
||||
|
||||
diff = l.SimPosition.Y - item.SimPosition.Y;
|
||||
diff = body.SimPosition.Y - item.SimPosition.Y;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (l.SimPosition.Y > simPos.Y || l.SimPosition.Y < simPos.Y - simSize.Y) continue;
|
||||
if (body.SimPosition.Y > simPos.Y || body.SimPosition.Y < simPos.Y - simSize.Y) continue;
|
||||
|
||||
diff = l.SimPosition.X - item.SimPosition.X;
|
||||
diff = body.SimPosition.X - item.SimPosition.X;
|
||||
}
|
||||
|
||||
if (Math.Sign(diff) != dir)
|
||||
{
|
||||
SoundPlayer.PlayDamageSound(DamageSoundType.LimbBlunt, 1.0f, l.body);
|
||||
SoundPlayer.PlayDamageSound(DamageSoundType.LimbBlunt, 1.0f, body);
|
||||
|
||||
if (isHorizontal)
|
||||
{
|
||||
l.body.SetTransform(new Vector2(l.SimPosition.X, item.SimPosition.Y + dir * simSize.Y * 2.0f), l.body.Rotation);
|
||||
l.body.ApplyLinearImpulse(new Vector2(isOpen ? 0.0f : 1.0f, dir * 2.0f));
|
||||
body.SetTransform(new Vector2(body.SimPosition.X, item.SimPosition.Y + dir * simSize.Y * 2.0f), body.Rotation);
|
||||
body.ApplyLinearImpulse(new Vector2(isOpen ? 0.0f : 1.0f, dir * 2.0f));
|
||||
}
|
||||
else
|
||||
{
|
||||
l.body.SetTransform(new Vector2(item.SimPosition.X + dir * simSize.X * 1.2f, l.SimPosition.Y), l.body.Rotation);
|
||||
l.body.ApplyLinearImpulse(new Vector2(dir * 0.5f, isOpen ? 0.0f : -1.0f));
|
||||
body.SetTransform(new Vector2(item.SimPosition.X + dir * simSize.X * 1.2f, body.SimPosition.Y), body.Rotation);
|
||||
body.ApplyLinearImpulse(new Vector2(dir * 0.5f, isOpen ? 0.0f : -1.0f));
|
||||
}
|
||||
}
|
||||
|
||||
if (isHorizontal)
|
||||
{
|
||||
if (Math.Abs(l.SimPosition.Y - item.SimPosition.Y) > simSize.Y * 0.5f) continue;
|
||||
if (Math.Abs(body.SimPosition.Y - item.SimPosition.Y) > simSize.Y * 0.5f) continue;
|
||||
|
||||
l.body.ApplyLinearImpulse(new Vector2(isOpen ? 0.0f : 1.0f, dir * 0.5f));
|
||||
body.ApplyLinearImpulse(new Vector2(isOpen ? 0.0f : 1.0f, dir * 0.5f));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Math.Abs(l.SimPosition.X - item.SimPosition.X) > simSize.X * 0.5f) continue;
|
||||
if (Math.Abs(body.SimPosition.X - item.SimPosition.X) > simSize.X * 0.5f) continue;
|
||||
|
||||
l.body.ApplyLinearImpulse(new Vector2(dir * 0.5f, isOpen ? 0.0f : -1.0f));
|
||||
body.ApplyLinearImpulse(new Vector2(dir * 0.5f, isOpen ? 0.0f : -1.0f));
|
||||
}
|
||||
|
||||
c.StartStun(0.2f);
|
||||
|
||||
Reference in New Issue
Block a user