From 47d1138fbbe604b5edbfdbcfd789eca1295a91d6 Mon Sep 17 00:00:00 2001 From: Ling Zhan Date: Wed, 8 Jun 2022 13:38:56 +0800 Subject: [PATCH] fix PhysX Physics costs some time even there is not physics node in scene #11382 (#11396) Co-authored-by: zhanling --- cocos/physics/physx/physx-world.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/cocos/physics/physx/physx-world.ts b/cocos/physics/physx/physx-world.ts index c1bfe16614..fe7beb2248 100644 --- a/cocos/physics/physx/physx-world.ts +++ b/cocos/physics/physx/physx-world.ts @@ -69,6 +69,7 @@ export class PhysXWorld extends PhysXInstance implements IPhysicsWorld { } step (deltaTime: number, _timeSinceLastCalled?: number, _maxSubStep = 0): void { + if (this.wrappedBodies.length === 0) return; this._simulate(deltaTime); if (!PX.MULTI_THREAD) { this._fetchResults();