Update content vectors to numerics (#17759)
This commit is contained in:
@@ -16,6 +16,7 @@ using Robust.Shared.Physics.Controllers;
|
||||
using Robust.Shared.Timing;
|
||||
using Robust.Shared.Utility;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Numerics;
|
||||
using Content.Shared.Mobs.Systems;
|
||||
using Robust.Shared.Physics.Components;
|
||||
using Robust.Shared.Physics.Systems;
|
||||
@@ -180,7 +181,7 @@ namespace Content.Shared.Movement.Systems
|
||||
var parentRotation = GetParentGridAngle(mover, xformQuery);
|
||||
var worldTotal = _relativeMovement ? parentRotation.RotateVec(total) : total;
|
||||
|
||||
DebugTools.Assert(MathHelper.CloseToPercent(total.Length, worldTotal.Length));
|
||||
DebugTools.Assert(MathHelper.CloseToPercent(total.Length(), worldTotal.Length()));
|
||||
|
||||
var velocity = physicsComponent.LinearVelocity;
|
||||
float friction;
|
||||
@@ -289,7 +290,7 @@ namespace Content.Shared.Movement.Systems
|
||||
|
||||
private void Friction(float minimumFrictionSpeed, float frameTime, float friction, ref Vector2 velocity)
|
||||
{
|
||||
var speed = velocity.Length;
|
||||
var speed = velocity.Length();
|
||||
|
||||
if (speed < minimumFrictionSpeed)
|
||||
return;
|
||||
@@ -310,8 +311,8 @@ namespace Content.Shared.Movement.Systems
|
||||
|
||||
private void Accelerate(ref Vector2 currentVelocity, in Vector2 velocity, float accel, float frameTime)
|
||||
{
|
||||
var wishDir = velocity != Vector2.Zero ? velocity.Normalized : Vector2.Zero;
|
||||
var wishSpeed = velocity.Length;
|
||||
var wishDir = velocity != Vector2.Zero ? velocity.Normalized() : Vector2.Zero;
|
||||
var wishSpeed = velocity.Length();
|
||||
|
||||
var currentSpeed = Vector2.Dot(currentVelocity, wishDir);
|
||||
var addSpeed = wishSpeed - currentSpeed;
|
||||
|
||||
Reference in New Issue
Block a user