Skip to content

Commit

Permalink
fix: don't break lerp effect in local mode
Browse files Browse the repository at this point in the history
  • Loading branch information
zhuxudong committed Jan 16, 2025
1 parent 393f8e3 commit 4d006a5
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions packages/core/src/postProcess/PostProcessManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,9 @@ export class PostProcessManager {
}

const isGlobal = postProcess.isGlobal;
let interpFactor = 1; // Global default value
let interpFactor = 1; // default value in global mode

Check warning on line 73 in packages/core/src/postProcess/PostProcessManager.ts

View check run for this annotation

Codecov / codecov/patch

packages/core/src/postProcess/PostProcessManager.ts#L73

Added line #L73 was not covered by tests
if (!isGlobal) {
interpFactor = 0; // default value in local mode

Check warning on line 75 in packages/core/src/postProcess/PostProcessManager.ts

View check run for this annotation

Codecov / codecov/patch

packages/core/src/postProcess/PostProcessManager.ts#L75

Added line #L75 was not covered by tests
const currentColliders = PostProcessManager._tempColliders;
const cameraPosition = camera.entity.transform.worldPosition;
const blendDistance = postProcess.blendDistance;
Expand Down Expand Up @@ -102,15 +103,10 @@ export class PostProcessManager {
Logger.warn(
`No collider shape found in the entity:"${postProcess.entity.name}", the local mode of post process will not take effect.`
);
continue;
}

// Post process has no influence, ignore it
if (closestDistance > blendDistance) {
continue;
}

if (blendDistance > 0) {
if (closestDistance <= blendDistance && blendDistance > 0) {

Check warning on line 109 in packages/core/src/postProcess/PostProcessManager.ts

View check run for this annotation

Codecov / codecov/patch

packages/core/src/postProcess/PostProcessManager.ts#L109

Added line #L109 was not covered by tests
interpFactor = 1 - closestDistance / blendDistance;
}
}
Expand Down

0 comments on commit 4d006a5

Please sign in to comment.