swift - SKSpriteNodes 相互碰撞并粘在上面
问题描述
我的 SKSpritekit 节点相互堆叠并相互粘连。我已经通过 sks 文件并以编程方式添加了 SKSprite 节点。
let texture = SKTexture(image: #imageLiteral(resourceName: "cone"))
trCone = SKSpriteNode(texture: texture, normalMap: texture)
//trCone?.texture = SKTexture(image: #imageLiteral(resourceName: "cone"))
trCone?.size = CGSize(width: 60, height: 65)
trCone?.position = CGPoint(x: 153, y: 267)
trCone?.zPosition = 15
trCone?.name = trainingStuff.text
trCone?.physicsBody = SKPhysicsBody(texture: SKTexture(image: #imageLiteral(resourceName: "cone")), size: CGSize(width: 60, height: 65))
trCone?.physicsBody?.allowsRotation = false
trCone?.physicsBody?.isDynamic = false
trCone?.physicsBody?.categoryBitMask = .zero
trCone?.physicsBody?.collisionBitMask = .zero
myTrainigArr?.append(trCone!)
self.myScene!.addChild(trCone!)
This is how I add the nodes. I would like them to overlap each other and pass through each other without any collisions but this is the outcome. When I try to move the nodes after they collide one is now stuck on top of the other. Any suggestions will be appreciated.
解决方案
推荐阅读
- jdbc - HSQL 中的 setArray() 异常
- javascript - 如何使用 JavaScript 创建用户名正则表达式?
- python - 更改 sklearn 管道的参数
- javascript - 需要回答“参数 (number[]) 与 SpreadsheetApp.Range.setValues 的方法签名不匹配”错误
- r - R Regex:修改字符串末尾不同长度的数字
- firebase - 无法从数据库获取 DataSnapshot 并获取空值
- python - 对于特定的 pep8 问题,什么是解析 python 代码的更好方法
- angular - TypeError: 你提供了'function selectOperator(source$) 需要流的地方
- powershell - 根据共性(直接和间接)将哈希表分组在一起
- compiler-errors - NDK 静态库项目无法为 arm64-v8a 编译