I am a novice programmer trying to learn Phaser. I am using Phaser 3.21 and using arcade physics system.
When two bodies collide I get the following error(I am not allowed to add any attachments so…)-
phaser.js:98517 Uncaught TypeError: processCallback.call is not a function
at World.separate (phaser.js:98517)
at World.collideSpriteVsSprite (phaser.js:99064)
at World.collideHandler (phaser.js:98997)
at World.collideObjects (phaser.js:98907)
at Collider.update (phaser.js:101945)
at World.update (phaser.js:98137)
at EventEmitter.emit (phaser.js:1752)
at Systems.step (phaser.js:34553)
at SceneManager.update (phaser.js:76938)
at Game.step (phaser.js:138050)
separate @ phaser.js:98517
collideSpriteVsSprite @ phaser.js:99064
collideHandler @ phaser.js:98997
collideObjects @ phaser.js:98907
update @ phaser.js:101945
update @ phaser.js:98137
emit @ phaser.js:1752
step @ phaser.js:34553
update @ phaser.js:76938
step @ phaser.js:138050
step @ phaser.js:66335
step @ phaser.js:66582
requestAnimationFrame (async)
step @ phaser.js:66584
And the code causing error is -
Code causing error - this.physics.add.collider(gameState.pickup1, gameState.player1 ,hitPickup, gameState.pickup1, gameState.player1);
You need to put this function call in scene’s create
function and pass this
as the last argument to it. First two are the game objects, third is collisioncallback
which you have, fourth is processcallback
which returns true or false to determine if the collisioncallback
will be called and you can pass null
.
1 Like