Could not create physics body error on different devices

Viewed 39

I have been developing my application and testing using the iPhone 11 Pro simoulator and everything has been working as designed. When I switched to an iPhone 11 regular or older model I get an error, 2020-04-11 12:15:44.172116-0400 NinjaEscape[98021:3425018] PhysicsBody: Could not create physics body. IT works fine on 11 pro or iPad. This only happens to my players physics body. The rest of the bodies are created without an issue.

Here is function for creating my player:

 func createPlayer(){
    let playerTexture = SKTexture(imageNamed:"NinjaR_1")
    player = SKSpriteNode(texture: playerTexture)
    player.zPosition = 10
    player.position = CGPoint(x: frame.width/2.5, y: frame.height * 0.30)
    player.setScale(2)
    player.texture?.size()

    player.physicsBody = SKPhysicsBody(texture: player.texture!, size: player.frame.size)
    player.physicsBody?.contactTestBitMask = 1
    player.physicsBody?.isDynamic = true
    player.physicsBody?.categoryBitMask = 7
    player.physicsBody?.collisionBitMask = 5 // 2 | 3
    player.physicsBody?.allowsRotation = false
    player.physicsBody?.usesPreciseCollisionDetection = true

    addChild(player)
0 Answers
Related