[英]SpriteKit Custom Node Boundary
I need to make a custom node boundary around this shape: http://imgur.com/TITlguy 我需要围绕此形状创建自定义节点边界: http : //imgur.com/TITlguy
When I use the traditional rectangle shape, it's not accurate to when the main player collides with the rounded edges. 当我使用传统的矩形形状时,这与主玩家与圆形边缘碰撞时的精度并不准确。
Here is my code so far: 到目前为止,这是我的代码:
rightWall.physicsBody = SKPhysicsBody(rectangleOfSize: rightWall.size)
rightWall.physicsBody?.categoryBitMask = PhysicsCatagory.platform
rightWall.physicsBody?.collisionBitMask = PhysicsCatagory.player
rightWall.physicsBody?.contactTestBitMask = PhysicsCatagory.player
rightWall.physicsBody?.dynamic = false
rightWall.physicsBody?.affectedByGravity = false
您应该使用带有纹理的init方法来生成物理物体。
init(texture texture: SKTexture, size size: CGSize)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.