SceneKit objects collide in their bounding box, not along the grid

I use the "DAE" model as SCNGeometry.

Half TUBE

Trying to use it as a physical form of the body:

    let url = Bundle.main.url(forResource: "art.scnassets/half", withExtension: "dae")
    let sceneSource = SCNSceneSource(url: url!, options: nil)
    let tubeGeometry = (sceneSource?.entryWithIdentifier("Cube-mesh", withClass: SCNGeometry.self ))! as SCNGeometry

    tubeNode = SCNNode(geometry: tubeGeometry)
    tubeNode.position = SCNVector3(0, 1, 0)
    tubeNode.eulerAngles = SCNVector3Make(1.5, 2, 0)

    let tubeShape = SCNPhysicsShape(geometry: tubeGeometry, options: nil)
    let tubeBody = SCNPhysicsBody(type: .static, shape: tubeShape)
    tubeNode.physicsBody = tubeBody
    scene.rootNode.addChildNode(tubeNode)

Do not perceive the properties of geometric objects (edges, faces, etc.). Understands the cube as it seems. Thus, the ball collides with an invisible plane, which is not my object, but should fall inward, as in the screenshot below: scene

Any ideas / tips, why? Please help me solve this problem ...

Thanks in advance!

+4
source share
1 answer

"SCNPhysicsShapeTypeConcavePolyhedron" ( ). SCNView debugOptions .

+3

Source: https://habr.com/ru/post/1673788/


All Articles