diff --git a/cocos/physics/physx/physx-shared-body.ts b/cocos/physics/physx/physx-shared-body.ts index 8dca8fb10a..3c9ec0a9c2 100644 --- a/cocos/physics/physx/physx-shared-body.ts +++ b/cocos/physics/physx/physx-shared-body.ts @@ -339,6 +339,7 @@ export class PhysXSharedBody { } setGroup (v: number): void { + v >>>= 0; //convert to unsigned int(32bit) for physx this._filterData.word0 = v; this.updateFilterData(); } @@ -348,17 +349,19 @@ export class PhysXSharedBody { } addGroup (v: number): void { + v >>>= 0; //convert to unsigned int(32bit) for physx this._filterData.word0 |= v; this.updateFilterData(); } removeGroup (v: number): void { + v >>>= 0; //convert to unsigned int(32bit) for physx this._filterData.word0 &= ~v; this.updateFilterData(); } setMask (v: number): void { - if (v === -1) v = 0xffffffff; + v >>>= 0; //convert to unsigned int(32bit) for physx this._filterData.word1 = v; this.updateFilterData(); } @@ -368,11 +371,13 @@ export class PhysXSharedBody { } addMask (v: number): void { + v >>>= 0; //convert to unsigned int(32bit) for physx this._filterData.word1 |= v; this.updateFilterData(); } removeMask (v: number): void { + v >>>= 0; //convert to unsigned int(32bit) for physx this._filterData.word1 &= ~v; this.updateFilterData(); }