If(collide and create.sprite)

hi hello there is a character in my game when it touches an object it turns into character 2. With the “if” I want to check if the character is 2, does it touch the object? I want him to check.
if (this.characters = this.physics.add.sprite (game.config.width / 4 * 1, game.config.height / 8 * 4," dropluCharacter ") && this.physics.world.collide (this. character, this.dusmanGroup, function () {}, null, this)) {}
I tried the command and there was an error.
Error: TypeError: Cannot read property 'velocity' of undefined at playGame. <anonymous>
Please help IMMEDIATELY. THANKS NOW!

Not sure if it’s what you need, i’ll need some more details but:

let rectGroup;

class Scene1 extends Phaser.Scene {

    constructor() {
        super('Scene1');
    }

    create(){
        rectGroup = this.add.group();

        // Replace this with your "collision listener" function
        this.physics.world.on('worldbounds', ()=>{
            let r = this.add.rectangle(0, 0, 80, 80, 0x6666ff).setOrigin(0);
            this.physics.add.existing(r);
            rectGroup.add(r);
            addPhisycs(r);
        });
    }
}

function addPhisycs(r) {
    r.body.setVelocity(100, 200)
    .setBounce(1, 1)
    .setCollideWorldBounds(true);
    r.body.onWorldBounds = true;
}