summaryrefslogtreecommitdiff
path: root/frontend/2d/_collisions/rectangle_line
diff options
context:
space:
mode:
Diffstat (limited to 'frontend/2d/_collisions/rectangle_line')
-rwxr-xr-xfrontend/2d/_collisions/rectangle_line/dist/output.wasmbin50694 -> 50712 bytes
-rw-r--r--frontend/2d/_collisions/rectangle_line/main.cpp2
2 files changed, 1 insertions, 1 deletions
diff --git a/frontend/2d/_collisions/rectangle_line/dist/output.wasm b/frontend/2d/_collisions/rectangle_line/dist/output.wasm
index dd44607..f23eebd 100755
--- a/frontend/2d/_collisions/rectangle_line/dist/output.wasm
+++ b/frontend/2d/_collisions/rectangle_line/dist/output.wasm
Binary files differ
diff --git a/frontend/2d/_collisions/rectangle_line/main.cpp b/frontend/2d/_collisions/rectangle_line/main.cpp
index 9ccbc7e..74e1ec2 100644
--- a/frontend/2d/_collisions/rectangle_line/main.cpp
+++ b/frontend/2d/_collisions/rectangle_line/main.cpp
@@ -246,7 +246,7 @@ void resolveCollision(Rigidbody* first, Rigidbody* second, IntersectionResult* i
float32 linearDenomPart = collisionNormal.dot(collisionNormal * (1.f / first->mass + 1.f / second->mass));
float32 rotationalDenomPart = (firstPerpNorm * firstPerpNorm) / first->momentOfInertia + (sndPerpNorm * sndPerpNorm) / second->momentOfInertia;
- float32 impulseMagnitude = numerator / (linearDenomPart);// + rotationalDenomPart);
+ float32 impulseMagnitude = numerator / (linearDenomPart + rotationalDenomPart);
first->velocity = first->velocity + (collisionNormal * (impulseMagnitude / first->mass));
second->velocity = second->velocity - (collisionNormal * (impulseMagnitude / second->mass));
first->rotationalVelocity = first->rotationalVelocity + firstPerp.dot(collisionNormal * impulseMagnitude) / first->momentOfInertia;