@@ -99,20 +99,19 @@ namespace Content.Server.Physics.Controllers
|
|||||||
// inputs will do different things.
|
// inputs will do different things.
|
||||||
// TODO: Do that
|
// TODO: Do that
|
||||||
float speedCap;
|
float speedCap;
|
||||||
// This is comically fast for debugging
|
var angularSpeed = 0.75f;
|
||||||
var angularSpeed = 20000f;
|
|
||||||
|
|
||||||
// ShuttleSystem has already worked out the ratio so we'll just multiply it back by the mass.
|
// ShuttleSystem has already worked out the ratio so we'll just multiply it back by the mass.
|
||||||
var movement = (mover.VelocityDir.walking + mover.VelocityDir.sprinting);
|
var movement = (mover.VelocityDir.walking + mover.VelocityDir.sprinting);
|
||||||
|
|
||||||
|
switch (shuttleComponent.Mode)
|
||||||
|
{
|
||||||
|
case ShuttleMode.Docking:
|
||||||
if (physicsComponent.LinearVelocity.LengthSquared == 0f)
|
if (physicsComponent.LinearVelocity.LengthSquared == 0f)
|
||||||
{
|
{
|
||||||
movement *= 5f;
|
movement *= 5f;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (shuttleComponent.Mode)
|
|
||||||
{
|
|
||||||
case ShuttleMode.Docking:
|
|
||||||
if (movement.Length != 0f)
|
if (movement.Length != 0f)
|
||||||
physicsComponent.ApplyLinearImpulse(physicsComponent.Owner.Transform.WorldRotation.RotateVec(movement) * shuttleComponent.SpeedMultipler * physicsComponent.Mass);
|
physicsComponent.ApplyLinearImpulse(physicsComponent.Owner.Transform.WorldRotation.RotateVec(movement) * shuttleComponent.SpeedMultipler * physicsComponent.Mass);
|
||||||
|
|
||||||
@@ -121,13 +120,19 @@ namespace Content.Server.Physics.Controllers
|
|||||||
case ShuttleMode.Cruise:
|
case ShuttleMode.Cruise:
|
||||||
if (movement.Length != 0.0f)
|
if (movement.Length != 0.0f)
|
||||||
{
|
{
|
||||||
|
if (physicsComponent.LinearVelocity.LengthSquared == 0f)
|
||||||
|
{
|
||||||
|
movement.Y *= 5f;
|
||||||
|
}
|
||||||
|
|
||||||
// Currently this is slow BUT we'd have a separate multiplier for docking and cruising or whatever.
|
// Currently this is slow BUT we'd have a separate multiplier for docking and cruising or whatever.
|
||||||
physicsComponent.ApplyLinearImpulse((physicsComponent.Owner.Transform.WorldRotation + new Angle(MathF.PI / 2)).ToVec() *
|
physicsComponent.ApplyLinearImpulse((physicsComponent.Owner.Transform.WorldRotation + new Angle(MathF.PI / 2)).ToVec() *
|
||||||
shuttleComponent.SpeedMultipler *
|
shuttleComponent.SpeedMultipler *
|
||||||
physicsComponent.Mass *
|
physicsComponent.Mass *
|
||||||
movement.Y *
|
movement.Y *
|
||||||
10);
|
2.5f);
|
||||||
physicsComponent.ApplyAngularImpulse(-movement.X * angularSpeed);
|
|
||||||
|
physicsComponent.ApplyAngularImpulse(-movement.X * angularSpeed * physicsComponent.Mass);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO WHEN THIS ACTUALLY WORKS
|
// TODO WHEN THIS ACTUALLY WORKS
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ namespace Content.Server.Shuttles
|
|||||||
foreach (var fixture in args.NewFixtures)
|
foreach (var fixture in args.NewFixtures)
|
||||||
{
|
{
|
||||||
fixture.Mass = fixture.Area * TileMassMultiplier;
|
fixture.Mass = fixture.Area * TileMassMultiplier;
|
||||||
|
fixture.Restitution = 0.1f;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (body.Owner.TryGetComponent(out ShuttleComponent? shuttleComponent))
|
if (body.Owner.TryGetComponent(out ShuttleComponent? shuttleComponent))
|
||||||
@@ -123,7 +124,7 @@ namespace Content.Server.Shuttles
|
|||||||
component.BodyType = BodyType.Dynamic;
|
component.BodyType = BodyType.Dynamic;
|
||||||
component.BodyStatus = BodyStatus.InAir;
|
component.BodyStatus = BodyStatus.InAir;
|
||||||
//component.FixedRotation = false; TODO WHEN ROTATING SHUTTLES FIXED.
|
//component.FixedRotation = false; TODO WHEN ROTATING SHUTTLES FIXED.
|
||||||
component.FixedRotation = true;
|
component.FixedRotation = false;
|
||||||
component.LinearDamping = 0.2f;
|
component.LinearDamping = 0.2f;
|
||||||
component.AngularDamping = 0.1f;
|
component.AngularDamping = 0.1f;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ namespace Content.Shared.Shuttles
|
|||||||
public float SpeedMultipler { get; set; } = 200.0f;
|
public float SpeedMultipler { get; set; } = 200.0f;
|
||||||
|
|
||||||
[ViewVariables]
|
[ViewVariables]
|
||||||
public ShuttleMode Mode { get; set; } = ShuttleMode.Docking;
|
public ShuttleMode Mode { get; set; } = ShuttleMode.Cruise;
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum ShuttleMode : byte
|
public enum ShuttleMode : byte
|
||||||
|
|||||||
Reference in New Issue
Block a user