This commit is contained in:
2023-12-04 14:06:52 +03:00
parent c66eec61ac
commit 84ecc68320
3 changed files with 82 additions and 70 deletions

View File

@@ -63,9 +63,9 @@ public class PhysicsEngine2D : IPhysicsEngine2D
continue;
if (colliders[colliderIX].BehaviourController.TryGetBehaviour(out IRigidBody2D? rigidX))
rigidX.Velocity = -normal * rigidX.Velocity.Length();
rigidX.Velocity = Vector2.Reflect(rigidX.Velocity, normal);
if (colliders[colliderIY].BehaviourController.TryGetBehaviour(out IRigidBody2D? rigidY))
rigidY.Velocity = normal * rigidY.Velocity.Length();
rigidY.Velocity = Vector2.Reflect(rigidY.Velocity, normal);
// Console.WriteLine($"Collision");
break;