Friction Not Working

Hi.
i am making a game .In my game scene i have a platform and 1 player .I am applying velocity on my player using this.physics.velocityFromRotation() and i am giving some random angle.Now the problem is when ever my player lands on a platform it is not stopping ,it is sliding very slowly. I applied friction to both platform and player using this.player.body.friction.x=1 and likewise to the platform.

i don’t know how to solve this issue.

Thank you

Set the platform’s friction.x to 0.

Thank you for the reply @samme
this.Player.body.friction.x=0 //for the player
this.bottom.body.friction.x=0 // for the ground.

still it is sliding on the ground.
i am using arcade physics.

do you know what is the issue here?

Forget friction, leave that alone.

If you want the player to slow down gradually, you can use drag. If you want it to stop immediately, you can zero the horizontal velocity.

ok. i will try that one.

do you know how to implement it?
Any example will help me

thank you

this.Player.body.setDragX(0)
and when you want to slow down the player
this.Player.body.setDragX(200) // you need to search the good value

@BlunT76

not working. some where i am doing amistake.

I will create a simple project and i will try these solutions.

Thank you

Show us your code please

//for player

this.Player= this.physics.add.sprite(750/2,1334-500,‘player’)

           this.Player.setScale(0.35,0.35)
          this.Player.setCollideWorldBounds(true);
        this.Player.setMass(10)
        this.Player.body.friction.x=0  
       //this.Player.body.allowDrag= true;
        this.Player.body.setDragX(0)

//for ground
//bottom

           this.bottom = this.physics.add.sprite(750/2,1335,'boundary')   
           this.bottom.displayWidth=750;this.bottom.displayHeight=100
           this.bottom.setImmovable(true)
           this.bottom.body.allowGravity=false
           this.bottom.setVisible(false)
           this.bottom.body.friction.x=0 
          this.bottom.body.setDragX(200)

then added collider
this.physics.add.collider(this.Player, this.bottom);

You doesn’t define what happens when they collide:

this.physics.add.collider(this.Player, this.bottom, function(player, bottom) {
    player.setDragX(200);
}, null, this;

Let me know if it works better

Thank you.
yes. it is working now. i set the dragx to 500.

how to reset the value to normal after collision?

and what is the initial dragX value?
Thank you

dragX default value is 0.
To reset the value you can use a timer

this.physics.add.collider(this.Player, this.bottom, function(player, bottom) {
    player.setDragX(500);
    this.time.addEvent({
        delay: 500, // in ms
        callback: () => this.player.setDragX(0); // called when delay is reached
    });
}, null, this;

Thank you. i will check it now.
i am new to phaser.
please suggest me some tutorials.
And i am actually building a fb instant game.i am facing issue with resolution .game is not fitting with the mobile screen.
suggest some content for that also.
Thank you

For mobile resolution look at game config , scale parameters.
For tutorials, google will give you better results than me, i usually use the docs and the official phaser 3 examples. And when it is not enough i search with google. It really depends on the kind of games you’re making.

Thank you bro.

you helped me alot :slightly_smiling_face: