Unable to use Concave representation of physics shape

风流意气都作罢 提交于 2020-06-25 06:31:33

问题


Whenever I assign a Concave physics shape

let physicsShape = SCNPhysicsShape(node: starNode, options: [SCNPhysicsShapeTypeKey:SCNPhysicsShapeTypeConcavePolyhedron])
starNode.physicsBody = SCNPhysicsBody(type: SCNPhysicsBodyType.Dynamic, shape: physicsShape)

the starNode just falls through all other nodes. I created starNode in Blender. I also noticed that in Scene Editor I am unable to assign PhysicsShapeType of starNode to Concave. Why is this happening and how do I fix it? The Convex shape type is out of question because it is an inaccurate representation of geometry.


回答1:


From the 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).

If you need a dynamic shape to be concave, your best bet is to create a compound shape from multiple SCNPhysicsShape objects (or from an hierarchy of nodes and their geometry).



来源:https://stackoverflow.com/questions/31648396/unable-to-use-concave-representation-of-physics-shape

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!