From a2b2d83015ecbec022a03e49ebd044526668993d Mon Sep 17 00:00:00 2001 From: Ling Zhan Date: Tue, 13 Dec 2022 11:12:39 +0800 Subject: [PATCH] [fix] when physics2d-builtin shape sets group should check collider then addShape (#13790) * [fix] when physics2d-builtin shape sets group should check collider then addShape #13361 * tweaks --- cocos/physics-2d/builtin/builtin-world.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cocos/physics-2d/builtin/builtin-world.ts b/cocos/physics-2d/builtin/builtin-world.ts index 8961c5469c..3768f9e96d 100644 --- a/cocos/physics-2d/builtin/builtin-world.ts +++ b/cocos/physics-2d/builtin/builtin-world.ts @@ -77,7 +77,9 @@ export class BuiltinPhysicsWorld implements IPhysicsWorld { updateShapeGroup (shape: BuiltinShape2D) { this.removeShape(shape); - this.addShape(shape); + if (shape.collider.enabledInHierarchy) { + this.addShape(shape); + } } step (deltaTime: number, velocityIterations = 10, positionIterations = 10) {