This commit is contained in:
2023-11-30 17:52:09 +03:00
parent 9ec92c1beb
commit 670842c1e3
9 changed files with 222 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Syntriax.Engine.Core.Abstract;
namespace Syntriax.Engine.Physics2D.Abstract;
public interface ICollider2D : IBehaviour, IAssignableTransform
{
Action<ICollider2D, ICollider2D>? OnCollision { get; set; }
Vector2 OffsetPosition { get; set; }
Vector2 OffsetScale { get; set; }
float OffsetRotation { get; set; }
IReadOnlyList<Vector2> Vertices { get; }
bool CheckCollision(ICollider2D collider);
void RecalculateVertices();
}

View File

@@ -0,0 +1,6 @@
namespace Syntriax.Engine.Physics2D.Abstract;
public interface ICollisionResolver2D
{
void ResolveCollision(ICollider2D colliderA, ICollider2D colliderB);
}

View File

@@ -0,0 +1,11 @@
namespace Syntriax.Engine.Physics2D.Abstract;
public interface IPhysicsEngine2D
{
int IterationCount { get; set; }
void AddRigidBody(IRigidBody2D rigidBody);
void RemoveRigidBody(IRigidBody2D rigidBody);
void Step(float deltaTime);
}

View File

@@ -0,0 +1,7 @@
namespace Syntriax.Engine.Physics2D.Abstract;
public interface IPhysicsMaterial2D
{
float Friction { get; set; }
float Restitution { get; set; }
}

View File

@@ -0,0 +1,15 @@
using Microsoft.Xna.Framework;
using Syntriax.Engine.Core.Abstract;
namespace Syntriax.Engine.Physics2D.Abstract;
public interface IRigidBody2D : IBehaviour, IAssignableTransform
{
IPhysicsMaterial2D Material { get; set; }
Vector2 Velocity { get; set; }
float AngularVelocity { get; set; }
float Mass { get; set; }
}