Skip to content

Commit

Permalink
Fix circle-circle collision logic
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanjermakov committed Dec 9, 2023
1 parent 3a0a232 commit 065ad3e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@vole-engine/core",
"version": "0.0.35",
"version": "0.0.36",
"description": "Tiny 2D game engine",
"repository": "https://github.com/dinomintstudio/vole",
"author": "ivanjermakov",
Expand Down
2 changes: 1 addition & 1 deletion src/collision/circle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export class Circle implements Collider {

intersects(other: Collider): boolean {
if (other instanceof Circle) {
return this.pos.distance(other.pos) <= Math.max(this.radius, other.radius)
return this.pos.distance(other.pos) <= this.radius + other.radius
}

// allows to implement collisions with custom colliders
Expand Down

0 comments on commit 065ad3e

Please sign in to comment.