Ramon Alvarez Mora Asked: 2020-09-27 08:12:19 +0800 CST 2020-09-27 08:12:19 +0800 CST 2020-09-27 08:12:19 +0800 CST Question about bounding boxes SpriteKit 772 How can you create a bounding box that collides with a circular shape, which is triangular? swift3 1 Answers Voted Best Answer jasilva 2020-09-27T12:38:27+08:002020-09-27T12:38:27+08:00 You need to use one of the polygonal type let polygonalSpaceShip = SKSpriteNode(texture: spaceShipTexture) let path = CGMutablePath() path.addLines(between: [CGPoint(x: 0, y: 0), CGPoint(x: 50, y: 50), CGPoint(x: 0, y: 50), CGPoint(x: 0, y: 0)]) //son 4 porqué el ultimo vuelve al origen SKPhysicsBody Example Although depending on your sprite you can try to use the alpha channel let texturedSpaceShip = SKSpriteNode(texture: spaceShipTexture) texturedSpaceShip.physicsBody = SKPhysicsBody(texture: spaceShipTexture, size: CGSize(width: circularSpaceShip.size.width, height: circularSpaceShip.size.height))
You need to use one of the polygonal type
SKPhysicsBody Example
Although depending on your sprite you can try to use the alpha channel