17 lines
503 B
C#
17 lines
503 B
C#
using Engine.Core;
|
|
|
|
namespace Engine.Physics2D;
|
|
|
|
public class RigidBody2D : Behaviour2D, IRigidBody2D
|
|
{
|
|
private const float LOWEST_ALLOWED_MASS = 0.00001f;
|
|
|
|
public IPhysicsMaterial2D Material { get; set; } = new PhysicsMaterial2DDefault();
|
|
|
|
public Vector2D Velocity { get; set; } = Vector2D.Zero;
|
|
public float AngularVelocity { get; set; } = 0f;
|
|
public bool IsStatic { get; set; } = false;
|
|
|
|
public float Mass { get; set => field = Math.Max(value, LOWEST_ALLOWED_MASS); } = 1f;
|
|
}
|