ios - How can one make only one side of a physics body active in SpriteKit? -


i have hero, ground , table. want make table-top active collision , contact hero. hero should able not jump on top , run "through" , jump on it, if player wants it, wherever wants. better example of i'm trying achieve - think mario. when running on ground, sky platforms appearing. jump on in middle of platform , stay there. need physics body not stop hero when contacting bottom, hold him if on top of it. i'm using body texture table:

    self.table.physicsbody = skphysicsbody(texture:table.texture, size:self.table.size) self.table.physicsbody?.dynamic = false self.table.physicsbody?.categorybitmask = collidertype.table.rawvalue self.table.physicsbody?.contacttestbitmask = collidertype.hero.rawvalue self.table.physicsbody?.collisionbitmask = collidertype.hero.rawvalue 

it obviously, not working. how can implement such thing?

i tried changing platforms collision bitmask wasn't working fine. found different solution.

inside update() function can check following

if player.physicsbody?.velocity.dy <= 0 {     player.physicsbody?.collisionbitmask = physicscategory.platform } else {     player.physicsbody?.collisionbitmask = physicscategory.none } 

in way, every time player going up, can pass through rocks, , every time falling, can stand.


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -