Phycis.group vs physic.staticGroup issues

Hi !

I’m trying to create a simple platformer, i’ve added some platforms to a physics group, it’s work but when the player is on a platform, it’s not triggered like the floor and i can’t jump from it.

Otherwise, i tried to do it with static group, it’w work perfectly, but my platforms have tween, and width static group, the body doesn’t move… (it moves with group).

My code :

 //LEVEL OBJECTS
  //FallingPlatforms
  this.fallingPlateforms = this.physics.add.group({
allowGravity: false,
immovable: true
  });
  // Let's get the spike objects, these are NOT sprites
  const fallingPlateformsObjects = map.getObjectLayer('fallingPlateforms')['objects'];
  //Rotation animation
  this.anims.create({
key: 'fly',
frames: this.anims.generateFrameNumbers('fallingPlateformsOn'),
frameRate: 20,
repeat: -1
  });
  //Wind particules
  const particles = this.add.particles('dust');
  

  // Now we create spikes in our sprite group for each object in our map
  fallingPlateformsObjects.forEach(fallingPlateformsObject => {
// Add new spikes to our sprite group, change the start y position to meet the platform
let fallingPlateform = this.fallingPlateforms.create(fallingPlateformsObject.x, fallingPlateformsObject.y, 'fallingPlateformsOn');

//Remove bottom collision
fallingPlateform.body.checkCollision.down = false;
fallingPlateform.body.immovable = true;

//Create emmiter for wind
let platformEmitter = particles.createEmitter({
  speed: 150,
  angle:90,
  emitZone:{
    type: 'random',    // 'random', or 'edge'
    source: new Phaser.Geom.Rectangle(-12, 0, 24),      // Geom like Circle, or a Path or Curve
  },
  on: true,
  blendMode: 'ADD',
  scale: { start: 0.6, end: 0 },
  alpha: { start: 0.1, end: 0 },
  quantity:1,
  lifespan: 400,
});
platformEmitter.setPosition(fallingPlateform.x, fallingPlateform.y+10);
platformEmitter.on = true;
//platformEmitter.startFollow(fallingPlateform);

//Create animation for mooving the
this.tweens.add({
  targets: fallingPlateform,
  y: fallingPlateform.y + 10,
  duration: 2000,
  yoyo: true,
  repeat:-1,
  delay:Phaser.Math.Between(0, 1000)
});
  });
  //play animation for all childrn of the group
  this.fallingPlateforms.playAnimation('fly'); 

Could you help me please ?

Sorry for my english, i do m best.

Perhaps a tween with target: fallingPlatform.body

Already tried, the sprites is not moving so.
If I tween sprite and body, in same tween, they are not sync…

Hmm, ok let’s try with a timer, test this code in phaser3 sandbox( accessible from any examples with the edit button)

var config = {
    type: Phaser.AUTO,
    width: 800,
    height: 600,
    parent: 'phaser-example',
    physics: {
        default: 'arcade',
        arcade: {
            debug: true,
            gravity: { y: 0 }
        }
    },
    scene: {
        preload: preload,
        create: create
    }
};

var game = new Phaser.Game(config);

function preload ()
{
    this.load.image('block', 'assets/sprites/block.png');
}

function create ()
{
    var group = this.physics.add.group({
        collideWorldBounds: true
    });

    var block1 = group.create(100, 300, 'block').setVelocity(0, 100);
    var block2 = group.create(300, 300, 'block').setVelocity(0, -100);
    var block3 = group.create(500, 300, 'block').setVelocity(0, 100);

    this.time.addEvent({
        delay: 2000,
        loop: true,
        callback: function () {
            group.children.entries.forEach(platform => platform.body.velocity.y *= -1);
        }
    });

    this.physics.add.collider(group, group);
}

Hi, I explored this case too, I prefer to not use it thank you …