Content update for ECS physics (#13291)

This commit is contained in:
metalgearsloth
2023-01-15 15:38:59 +11:00
committed by GitHub
parent 46d24bc36b
commit bf79d76666
61 changed files with 431 additions and 379 deletions

View File

@@ -111,12 +111,12 @@ public sealed class TetherGunSystem : SharedTetherGunSystem
if (TryComp<PhysicsComponent>(msg.Entity, out var body))
{
body.BodyStatus = BodyStatus.InAir;
_physics.SetBodyStatus(body, BodyStatus.InAir);
}
_physics.WakeBody(bodyA);
_physics.WakeBody(bodyB);
var joint = _joints.CreateMouseJoint(bodyA.Owner, bodyB.Owner, id: JointId);
_physics.WakeBody(tether, body: bodyA);
_physics.WakeBody(msg.Entity, body: bodyB);
var joint = _joints.CreateMouseJoint(tether, msg.Entity, id: JointId);
SharedJointSystem.LinearStiffness(5f, 0.7f, bodyA.Mass, bodyB.Mass, out var stiffness, out var damping);
joint.Stiffness = stiffness;
@@ -147,8 +147,9 @@ public sealed class TetherGunSystem : SharedTetherGunSystem
{
Timer.Spawn(1000, () =>
{
if (Deleted(body.Owner)) return;
body.BodyStatus = BodyStatus.OnGround;
if (Deleted(weh.Entity)) return;
_physics.SetBodyStatus(body, BodyStatus.OnGround);
});
}
@@ -186,7 +187,7 @@ public sealed class TetherGunSystem : SharedTetherGunSystem
// Force it awake, always
if (bodyQuery.TryGetComponent(entity.Entity, out var body))
{
_physics.WakeBody(body);
_physics.WakeBody(entity.Entity, body: body);
}
}