# Arcade Physics Collider – Sprite does not collide when tweening scale

**URL:** <https://phaser.discourse.group/t/arcade-physics-collider-sprite-does-not-collide-when-tweening-scale/8836>\
**Category:** Phaser 3\
**Created:** [February 8, 2021, 12:07am UTC](https://phaser.discourse.group/t/arcade-physics-collider-sprite-does-not-collide-when-tweening-scale/8836 "2021-02-08T00:07:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![phoenixstudios](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/phoenixstudios/32/4662_2.png) [@phoenixstudios](https://phaser.discourse.group/u/phoenixstudios)\
**Post date:** [February 8, 2021, 12:07am UTC](https://phaser.discourse.group/t/arcade-physics-collider-sprite-does-not-collide-when-tweening-scale/8836/1 "2021-02-08T00:07:10Z")

</div>

Hi,

I’ve used this Phaser example and added an immovable collide sprite:  
[Stop at position](http://labs.phaser.io/view.html?src=src/physics%5Carcade%5Cmove%20and%20stop%20at%20position.js)

This works fine normally, but if I add a tween scale the sprite goes through the collider sprite.  
Is there a way to stop this?

Reading many posts on the subject it’s something to do with the velocity I think?

Any help on this would be great. Thanks!

Code below of the mainscene:

```javascript
    import PhaserLogo from '../objects/phaserLogo'
    var target = new Phaser.Math.Vector2();
    var debug;
    var maincharacter;
    var distanceText;
    var yText;
    var obstacle;
    var obstacleLeft;

    export default class MainScene extends Phaser.Scene {
      

      constructor() {
        super({ key: 'MainScene' })
      }

      create() {
        
        maincharacter = this.physics.add.sprite(900, this.cameras.main.width / 2 - 20, 'phaser-logo');
        obstacleLeft = this.physics.add.sprite(750, 0, 'obstacle').setImmovable();
     
        obstacleLeft.setOrigin(0,0);

     
        obstacleLeft.displayHeight = this.cameras.main.height;
        
        obstacleLeft.body.immovable = true;
        obstacleLeft.body.moves = false;
        obstacleLeft.body.allowGravity = false;
      

        debug = this.add.graphics();

       

        this.input.on('pointerdown', function (pointer) {
          
          target.x = pointer.x;
          target.y = pointer.y;
            //move the character to an xy point
          this.physics.moveToObject(maincharacter, target, 400);
      
            //if Y is less than 400 – scale character down
          if (target.y < 400) {
       

           maincharacter.scene.tweens.add({
             targets: maincharacter.body.velocity ,
             ease: 'Linear',
              duration: 500,
              onComplete: function (tween, targets)
                {
                    
                  maincharacter.scene.tweens.add({
                        scale: .5,
                        targets: maincharacter,
                        ease: 'Linear',
                       duration: 500,
                    });
                },
          });
          
          }
    //if Y is more than 400 – scale character back to 1
          if (target.y > 400) {
          
     
            maincharacter.scene.tweens.add({
              targets: maincharacter.body.velocity ,
              ease: 'Linear',
               duration: 500,
               onComplete: function (tween, targets)
                 {
                     
                   maincharacter.scene.tweens.add({
                         scale: 1,
                         targets: maincharacter,
                         ease: 'Linear',
                        duration: 500,
                     });
                 },
           });
           
     
           }

        

      }, this);

      //create collider with obstacleLeft
      this.physics.add.collider(maincharacter, obstacleLeft, function (maincharacter, obstacle) {
       
      
        maincharacter.setVelocity(0);
        maincharacter.body.stop();
      });

      
      distanceText = this.add.text(10, 10, 'X Position:', { fill: '#ff004e' });
      yText = this.add.text(10, 30, 'Y Position:', { fill: '#ff004e' });

      }

      update() {
        var distance = Phaser.Math.Distance.Between(maincharacter.x, maincharacter.y, target.x, target.y);

        if (maincharacter.body.speed > 0)
        {
            distanceText.setText('X Position: ' + target.x);
            yText.setText('Y Position: ' + target.y);
            
            // 4 is our distance tolerance, i.e. how close the source can get to the target
            // before it is considered as being there. The faster it moves, the more tolerance is required.
            if (distance < 4)
            {
              maincharacter.body.reset(target.x, target.y);
            }
        }
      }
    }
```

---

<div class="post-metadata">

**Author:** ![samme](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/samme/32/5275_2.png) [@samme](https://phaser.discourse.group/u/samme)\
**Post date:** [February 8, 2021, 4:19am UTC](https://phaser.discourse.group/t/arcade-physics-collider-sprite-does-not-collide-when-tweening-scale/8836/2 "2021-02-08T04:19:59Z")

</div>

Resizing a body while it’s colliding with another can cause instability.

Increase `overlapBias` (e.g., 8) in your Arcade Physics config.

---

<div class="post-metadata">

**Author:** ![phoenixstudios](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/phoenixstudios/32/4662_2.png) [@phoenixstudios](https://phaser.discourse.group/u/phoenixstudios)\
**Post date:** [February 13, 2021, 12:27am UTC](https://phaser.discourse.group/t/arcade-physics-collider-sprite-does-not-collide-when-tweening-scale/8836/3 "2021-02-13T00:27:32Z")

</div>

Thanks, I ended up using a combination of Navmesh and colliders to stop the sprite sticking on the navmesh corners.

Cheers!
