无法使用物理形状的凹面表示
Unable to use Concave representation of physics shape
每当我分配一个凹形物理形状时
let physicsShape = SCNPhysicsShape(node: starNode, options: [SCNPhysicsShapeTypeKey:SCNPhysicsShapeTypeConcavePolyhedron])
starNode.physicsBody = SCNPhysicsBody(type: SCNPhysicsBodyType.Dynamic, shape: physicsShape)
starNode 正好穿过所有其他节点。我在 Blender 中创建了 starNode。我还注意到,在场景编辑器中,我无法将 starNode 的 PhysicsShapeType 分配给 Concave。为什么会发生这种情况,我该如何解决? Convex 形状类型是没有问题的,因为它是几何的不准确表示。
来自docs:
SCNPhysicsShapeTypeConcavePolyhedron
The physics shape is a concave polyhedron closely following the surface of the geometry.
This option provides the highest level of detail, at a high cost to simulation performance. Use it only for irregularly shaped bodies where precise collision behavior is crucial to your app’s design.
This shape type may only be used for static physics bodies (that is, those whose type
property is SCNPhysicsBodyTypeStatic
).
如果您需要一个凹形的动态形状,最好的办法是从多个 SCNPhysicsShape
对象(或从节点及其几何结构的层次结构)创建一个复合形状。
每当我分配一个凹形物理形状时
let physicsShape = SCNPhysicsShape(node: starNode, options: [SCNPhysicsShapeTypeKey:SCNPhysicsShapeTypeConcavePolyhedron])
starNode.physicsBody = SCNPhysicsBody(type: SCNPhysicsBodyType.Dynamic, shape: physicsShape)
starNode 正好穿过所有其他节点。我在 Blender 中创建了 starNode。我还注意到,在场景编辑器中,我无法将 starNode 的 PhysicsShapeType 分配给 Concave。为什么会发生这种情况,我该如何解决? Convex 形状类型是没有问题的,因为它是几何的不准确表示。
来自docs:
SCNPhysicsShapeTypeConcavePolyhedron
The physics shape is a concave polyhedron closely following the surface of the geometry.
This option provides the highest level of detail, at a high cost to simulation performance. Use it only for irregularly shaped bodies where precise collision behavior is crucial to your app’s design.
This shape type may only be used for static physics bodies (that is, those whose
type
property isSCNPhysicsBodyTypeStatic
).
如果您需要一个凹形的动态形状,最好的办法是从多个 SCNPhysicsShape
对象(或从节点及其几何结构的层次结构)创建一个复合形状。