I am making a spritekit platformer game with the help of spritekit objective c. I am using spritekit's physics engine for that, every thing is going well except that I haven't found a way to implement a plaformer style collision of the player with the platform.
What I want is my player should collide with the platform while he is falling and not while jumping. Like in following image. Here the player is jumping so he must not collide with the platform
and as In this image the player is falling so he must stand on the platform.
I tried to remove collision of the platform with player in didBeginContact method, but that didn't help as my platform is not dynamic type. Adding and removing collision does work with player but not with platform.
Any help will be greatly appreciated.
Edit: Here it is, example of what will happen if I change player's collision bitmask on contact with two adjacent platforms.
player will fall as soon as it will react with another platform.
Edit: aramusss's second solution is good, But it does create one more problem for me. As I have enemies in my game standing on platforms, if I remove platform's physics body the enemies will fall standing on it.