feat: Initial Physics Code From Previous Repo
This commit is contained in:
19
Engine.Physics2D/Abstract/ICollider2D.cs
Normal file
19
Engine.Physics2D/Abstract/ICollider2D.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using Syntriax.Engine.Core;
|
||||
using Syntriax.Engine.Core.Abstract;
|
||||
|
||||
namespace Syntriax.Engine.Physics2D.Abstract;
|
||||
|
||||
public interface ICollider2D : IBehaviour, IAssignableTransform
|
||||
{
|
||||
Action<ICollider2D, ICollider2D>? OnCollisionPreResolve { get; set; }
|
||||
|
||||
IRigidBody2D? RigidBody2D { get; }
|
||||
|
||||
IList<Vector2D> Vertices { get; }
|
||||
|
||||
bool CheckCollision(Vector2D point);
|
||||
void Recalculate();
|
||||
}
|
6
Engine.Physics2D/Abstract/ICollisionResolver2D.cs
Normal file
6
Engine.Physics2D/Abstract/ICollisionResolver2D.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
namespace Syntriax.Engine.Physics2D.Abstract;
|
||||
|
||||
public interface ICollisionResolver2D
|
||||
{
|
||||
void ResolveCollision(ICollider2D colliderA, ICollider2D colliderB);
|
||||
}
|
11
Engine.Physics2D/Abstract/IPhysicsEngine2D.cs
Normal file
11
Engine.Physics2D/Abstract/IPhysicsEngine2D.cs
Normal 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);
|
||||
}
|
7
Engine.Physics2D/Abstract/IPhysicsMaterial2D.cs
Normal file
7
Engine.Physics2D/Abstract/IPhysicsMaterial2D.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
namespace Syntriax.Engine.Physics2D.Abstract;
|
||||
|
||||
public interface IPhysicsMaterial2D
|
||||
{
|
||||
float Friction { get; }
|
||||
float Restitution { get; }
|
||||
}
|
14
Engine.Physics2D/Abstract/IRigidBody2D.cs
Normal file
14
Engine.Physics2D/Abstract/IRigidBody2D.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using Syntriax.Engine.Core;
|
||||
using Syntriax.Engine.Core.Abstract;
|
||||
|
||||
namespace Syntriax.Engine.Physics2D.Abstract;
|
||||
|
||||
public interface IRigidBody2D : IBehaviour, IAssignableTransform
|
||||
{
|
||||
IPhysicsMaterial2D Material { get; set; }
|
||||
|
||||
Vector2D Velocity { get; set; }
|
||||
float AngularVelocity { get; set; }
|
||||
|
||||
float Mass { get; set; }
|
||||
}
|
Reference in New Issue
Block a user