1

My problem is when me hero make contact with an obstacle he rotates and gets affected by that contact, if i set dynamic = false, contact stops getting detected. here is what my hero looks like:

    hero.physicsBody = SKPhysicsBody(rectangleOfSize: hero.size)
    hero.physicsBody?.categoryBitMask = heroGroup
    hero.physicsBody?.contactTestBitMask = obstacleGroup
CodeSmile
  • 64,284
  • 20
  • 132
  • 217
Abdou023
  • 1,654
  • 2
  • 24
  • 45
  • What do you want to happen when the hero makes contact with an obstacle? – 0x141E Nov 28 '14 at 21:32
  • i want to detect that contact but my hero doesn't get affected by it, meaning he doesn't get blocked, or change direction..etc – Abdou023 Nov 28 '14 at 21:57
  • 2
    You can achieve that by setting `hero.physicsBody?.collisionBitMask = 0` or by unsetting the appropriate `obstacleGroup` bits by `hero.physicsBody?.collisionBitMask &= ~(obstacleGroup)`. – 0x141E Nov 28 '14 at 22:36

0 Answers0