Matter one way collision

Hi.
How to implement one way collision using matter physics.
@BlunT76
Thank you

Hi,
I never used Matter physics, only arcade. Did you look in the docs?

i am looking into it. for now i didn’t get anything bro. @BlunT76

[SOLVED]

by using collision groups we can achieve one way collision .

first you have to create collision groups.
this.group1 = this.matter.world.nextGroup(); //gameObjects in this group will collide with one another

this.group2 = this.matter.world.nextGroup(true);//by
setting the flag true .gameObjects in this group wont collide with each other

now you can assign them to different objects.
obj1.setCollisionGroup(this.group1); //example code
obj2.setCollisionGroup(this.group1); //example code

now by putting condition in update function.by changing the collision group we can get our required functionality.

example given by phaser will help you
https://labs.phaser.io/edit.html?src=src\physics\matterjs\collision%20group.js.

Thank you.

1 Like