I have two SCNNodes that are Kinematic and aren't colliding, I've set the contactDelegate and the physics bodies are scaled correctly. I can see that the objects and physics bodies are colliding when I debug the app.
One of the bodies is a child node to a parent node that moves around the scene, while the other body is a physicsBody for a node that does not move
let aShape = SCNBox(width: 1, height: 1, length: 15, chamferRadius: 0)
let aNode = SCNNode(geometry: aShape)
aNode.position = SCNVector3(0,2,10)
aNode.physicsBody = SCNPhysicsBody(type: .kinematic, shape: SCNPhysicsShape(geometry: aShape, options: [SCNPhysicsShape.Option.scale : 0.02]))
aNode.physicsBody?.isAffectedByGravity = false
aNode.physicsBody?.allowsResting = false
pNode?.addChildNode(aNode)
aNode.physicsBody?.categoryBitMask = 4
aNode.physicsBody?.contactTestBitMask = 8
aNode.physicsBody?.collisionBitMask = 8
阅读后( SceneKit:如何检测碰撞而不会发生碰撞 ),我将两个节点都设置为具有静态物理体,并且可以正常工作:)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.