From df66174960da2f56fcdd724504c8249a39444334 Mon Sep 17 00:00:00 2001 From: dragoncoder047 <101021094+dragoncoder047@users.noreply.github.com> Date: Mon, 21 Oct 2024 22:56:55 -0400 Subject: [PATCH] fix: platformEffector shouldCollide this argument (#455) --- src/components/physics/effectors.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/physics/effectors.ts b/src/components/physics/effectors.ts index e4b3bed1..f1465dc3 100644 --- a/src/components/physics/effectors.ts +++ b/src/components/physics/effectors.ts @@ -165,7 +165,7 @@ export type PlatformEffectorCompOpt = { * If present, it overrides the `ignoreSides`; if absent, it is * automatically created from `ignoreSides`. */ - shouldCollide?: (obj: GameObj, normal: Vec2) => boolean + shouldCollide?: (this: GameObj, obj: GameObj, normal: Vec2) => boolean }; export interface PlatformEffectorComp extends Comp { @@ -195,7 +195,7 @@ export function platformEffector( if (this.platformIgnore.has(collision.target)) { collision.preventResolution(); } - else if (!opt.shouldCollide!(collision.target, collision.normal)) { + else if (!opt.shouldCollide!.call(this, collision.target, collision.normal)) { collision.preventResolution(); this.platformIgnore.add(collision.target); }