How to detect Collision if velocity of Object1 is 0 and overlapping Object2

Hi, In part of my game, I have to shoot a ball on a circular board. And I want to determine whether the ball stopped on board or outside of the board.
I was taking reference of example overlap zone
But I also noticed that if the velocity of block in example is 0 then collision won’t be deducted even if the block is overlapping the zone.
So how to overcome on it. Any suggestion will be appreciation.


For that case you can check embedded:

if (ball.body.touching.none && !ball.body.embedded) {/*…*/}

Or use the collideCallback in overlap() or…).

Thank you so much for quick response, I was stuck with it from 2 days and didn’t find body.embedded anywhere.
Also, Its an additional question just to get a quick suggestion if possible.
I am using velocityFromRotation method to shoot the ball and to reduce its speed with time, I am altering maxspeed in update method.
I am not sure if there are any good method. If there are any, can you suggest please.
Thanks in advance

Thanks once again. I tried Drag method earlier in wrong way. Sorry for such questions, I am using Phaser Physics for first time without brief knowledge and practicing.

Hi, Sorry for adding a new question in same thread.
I follow up the method you suggest to degrade the speed of ball.
It working awesome, But I also felt some limits in it.
Like if I set speed of ball upto 8000 and Drag to 0.10 with Physics world fps 60
I noticed ball stick to border colliders or slide through the collider before bounce back.
I altered the value of speed and drag with constant fps 60.
In some cases it worked but that was mostly on less speed only but i want to achieve same response on good speed.
Also, how to overcome on decimal values of speed of ball in update method, due to that it takes long time to reach 0 from 10.
Any suggestion would be helpful. And sorry again for asking different question in same thread.

Do you have an example of that?

I usually do

// In update():
if (ball.body.speed < MIN_SPEED) {

Hi, Thank you so much for answer.
Yes i am using stop() method in same way to handle decimal value. I was wonder if there are any other approach. anyways its working well too.

For this, I altered an example of Phaser3 available in docs.
I will add code here so you an simply replace the example code from it
I hope it will helpful to understand the scenario.

var config = {
    type: Phaser.AUTO,
    width: 640,
    height: 520,
    parent: 'phaser-example',
    pixelArt: true,
    physics: {
        default: 'arcade',
        arcade: {
            debug: true,
           // gravity: { y: 300 }
    scene: {
        preload: preload,
        create: create

new Phaser.Game(config);
var speedDrop = 0.50;
var maxSpeed = 3000; // 1500 normal bouncing || 3000 sticking and sliding with collider before bounce back on diffrent angles
function preload() {
    this.load.image('backdrop', 'assets/pics/platformer-backdrop.png');
    this.load.image('cannon_head', 'assets/tests/timer/cannon_head.png');
    this.load.image('cannon_body', 'assets/tests/timer/cannon_body.png');
    this.load.spritesheet('chick', 'assets/sprites/chick.png', { frameWidth: 16, frameHeight: 18 });

function create() {
    this.anims.create({ key: 'fly', frames: this.anims.generateFrameNumbers('chick', [0, 1, 2, 3]), frameRate: 5, repeat: -1 });
    this.add.image(320, 256, 'backdrop').setScale(2);

    var bT =  this.physics.add.staticImage(0, 0, 'cannon_head').setOrigin(0,0);
    bT.setSize(640, 50, false);

    var bB =  this.physics.add.staticImage(0, 520, 'cannon_head').setOrigin(0,0);
    bB.setSize(640, 50, false);

    var bL =  this.physics.add.staticImage(0, 0, 'cannon_head').setOrigin(0,0);
    bL.setSize(50, 520, false);

    var bR =  this.physics.add.staticImage(640, 0, 'cannon_head').setOrigin(0,0);
    bR.setSize(50, 520, false);

    var cannonHead = this.add.image(130, 416, 'cannon_head').setDepth(1);
    var cannon = this.add.image(130, 464, 'cannon_body').setDepth(1);

    // chick as Ball in case of my game
    var chick = this.physics.add.sprite(cannon.x, cannon.y - 50, 'chick').setScale(2);

    // setting Drag value

    var gfx ={ lineStyle: { width: 10, color: 0xffdd00, alpha: 0.5 } });
    var line = new Phaser.Geom.Line();
    var angle = 0;
    chick.disableBody(true, true);

    this.physics.add.collider(chick, bT);
    this.physics.add.collider(chick, bB);
    this.physics.add.collider(chick, bL);
    this.physics.add.collider(chick, bR);

    this.input.on('pointermove', function (pointer) {
        angle = Phaser.Math.Angle.BetweenPoints(cannon, pointer);
        cannonHead.rotation = angle;
        Phaser.Geom.Line.SetToAngle(line, cannon.x, cannon.y - 50, angle, 128);
    }, this);

    this.input.on('pointerup', function () {
        chick.enableBody(true, cannon.x, cannon.y - 50, true, true);'fly');
        // setting Max speed value
        this.physics.velocityFromRotation(angle, maxSpeed, chick.body.velocity);
    }, this);

You can run this code in the example

I don’t know a good way to solve that except by increasing physics fps. If your game has few bodies and few colliders, it’s probably fine to increase to 300 or so.

Hi, Thanks for reply.
Set Physics fps to 300?
Yes, In my game, I will have this 4 collider and a board to detect embedded of ball.

Also, Changing in fps will affect low configured devices? That’s one of main concern too.
I have plan to convert it into Cordova app.

I guess it might, but you probably have to test it out.

You don’t have to use 300, you can use the smallest FPS that seems to solve the problem.

Ok thanks. I made changes accordingly but it working fine in some devices. I will look for it once again after finishing up other parts.
Again, Thank you so much for all your support
Have a good time