小编Mag*_*s T的帖子

缩放 SCNNode 时更新 SCNPhysicsBody

我知道当节点扩展时 SCNPhysicsBody 不会扩展,但我还没有找到解决这个问题的好方法。我想缩放节点,然后在缩放后将 SCNPhysicsBody 更新为节点。

let box = SCNBox(width: 0.2, height: 0.3, length: 0.4, chamferRadius: 0.1)
box.firstMaterial?.diffuse.contents = UIColor.blue
var boxNode = SCNNode(geometry: box)
boxNode.scale = SCNVector3(0.5, 0.5, 0.5)
boxNode.position.x += 0.5

boxNode.physicsBody = SCNPhysicsBody(type: SCNPhysicsBodyType.static, shape: SCNPhysicsShape(geometry: box, options: nil))

sceneView.scene.rootNode.addChildNode(boxNode)
Run Code Online (Sandbox Code Playgroud)

在此处输入图片说明

有没有人想出一个很好的解决方案来解决这个问题?

xcode scenekit swift scnnode arkit

2
推荐指数
1
解决办法
870
查看次数

标签 统计

arkit ×1

scenekit ×1

scnnode ×1

swift ×1

xcode ×1