【问题标题】:How to setup node physics body shape to bounding box如何将节点物理体形设置为边界框
【发布时间】:2019-04-28 00:06:16
【问题描述】:

我有一个场景节点:

let node = SCNNode()

我想将节点物理体形设置为边界框。 看来:

node.physicsBody = SCNPhysicsBody(type: .dynamic, shape: nil)

设置 Convex 形状类型,但我需要边界框。怎么做?

【问题讨论】:

    标签: swift scenekit


    【解决方案1】:

    您可以使用不同的 SceneKit 几何形状作为 BBox 容器:

    let node = SCNNode()
    
    let boundingBox = SCNNode(geometry: SCNSphere(radius: 2))
    
    node.physicsBody = SCNPhysicsBody(type: .dynamic, 
                                     shape: .init(node: boundingBox, options: nil))
    

    【讨论】:

      猜你喜欢
      • 2021-02-27
      • 1970-01-01
      • 2019-06-23
      • 2013-05-08
      • 2020-08-25
      • 2021-09-01
      • 2016-11-18
      • 1970-01-01
      • 2020-10-20
      相关资源
      最近更新 更多