sprite kit - How to implement contact and collision only on one side of enemy in SpriteKit? -


let's have ball rolls , jumps , square blocks on same line. want ball collide left side of block. if ball jumping on block - should not contact, ball shouldn't land on top of square, should fall on ground , roll further. have code:

self.ball.physicsbody = skphysicsbody(circleofradius: cgfloat(self.ball.size.width / 2)) self.ball.physicsbody?.affectedbygravity = false self.ball.physicsbody?.categorybitmask = collidertype.ball.rawvalue self.ball.physicsbody?.collisionbitmask = collidertype.square.rawvalue self.ball.physicsbody?.contacttestbitmask = collidertype.square.rawvalue  self.square.physicsbody = skphysicsbody(texture:square.texture, size: self.square.size) self.square.physicsbody?.dynamic = false self.square.physicsbody?.categorybitmask = collidertype.square.rawvalue self.square.physicsbody?.contacttestbitmask = collidertype.ball.rawvalue self.square.physicsbody?.collisionbitmask = collidertype.ball.rawvalue 

it's working well, ball colliding whole square. how can change using swift in order make want?


Comments