Files
RobustToolbox/Robust.Shared/Physics/Manifold.cs
Pieter-Jan Briers d751c0b3ab Revert "Physics (#1602)"
This reverts commit fefcc7cba3.
2021-02-28 18:45:18 +01:00

27 lines
701 B
C#

using Robust.Shared.GameObjects;
using Robust.Shared.Maths;
namespace Robust.Shared.Physics
{
public readonly struct Manifold
{
public readonly IPhysicsComponent A;
public readonly IPhysicsComponent B;
public readonly Vector2 Normal;
public readonly bool Hard;
public Vector2 RelativeVelocity => B.LinearVelocity - A.LinearVelocity;
public bool Unresolved => Vector2.Dot(RelativeVelocity, Normal) < 0 && Hard;
public Manifold(IPhysicsComponent a, IPhysicsComponent b, bool hard)
{
A = a;
B = b;
Normal = PhysicsManager.CalculateNormal(a, b);
Hard = hard;
}
}
}