Enable shuttle rotation (#4798)

* Enable shuttle rotation

* Tweaks
This commit is contained in:
metalgearsloth
2021-10-09 10:55:10 +11:00
committed by GitHub
parent d5cc7fce8a
commit b888b1fd9c
3 changed files with 17 additions and 11 deletions

View File

@@ -99,20 +99,19 @@ namespace Content.Server.Physics.Controllers
// inputs will do different things.
// TODO: Do that
float speedCap;
// This is comically fast for debugging
var angularSpeed = 20000f;
var angularSpeed = 0.75f;
// 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);
if (physicsComponent.LinearVelocity.LengthSquared == 0f)
{
movement *= 5f;
}
switch (shuttleComponent.Mode)
{
case ShuttleMode.Docking:
if (physicsComponent.LinearVelocity.LengthSquared == 0f)
{
movement *= 5f;
}
if (movement.Length != 0f)
physicsComponent.ApplyLinearImpulse(physicsComponent.Owner.Transform.WorldRotation.RotateVec(movement) * shuttleComponent.SpeedMultipler * physicsComponent.Mass);
@@ -121,13 +120,19 @@ namespace Content.Server.Physics.Controllers
case ShuttleMode.Cruise:
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.
physicsComponent.ApplyLinearImpulse((physicsComponent.Owner.Transform.WorldRotation + new Angle(MathF.PI / 2)).ToVec() *
shuttleComponent.SpeedMultipler *
physicsComponent.Mass *
movement.Y *
10);
physicsComponent.ApplyAngularImpulse(-movement.X * angularSpeed);
2.5f);
physicsComponent.ApplyAngularImpulse(-movement.X * angularSpeed * physicsComponent.Mass);
}
// TODO WHEN THIS ACTUALLY WORKS