ios - SceneKit - 几何渗透

标签 ios unity-game-engine scenekit scene 3d-model

我将一个3D模型导入到ScenekKit中,然后改变肢体的欧拉角,让肢体做 Action 。不过,这时候,衣服和四肢会穿透。我该如何处理这种情况?

enter image description here

最佳答案

我认为您必须使用 continuousCollisionDetectionThreshold 实例属性。该值为您提供了 body 必须移动的最小距离,SceneKit 才能应用更精确(但 CPU/GPU 成本更高)的算法来检测与其他 body 的接触。

var continuousCollisionDetectionThreshold: CGFloat { get set }

SceneKit's physics engine can employ two kinds of collision detection:

  • With discrete collision detection, when SceneKit simulates physics before rendering each frame (see timeStep and SCNSceneRendererDelegate), it updates the position of each physics body based on the body's velocity during that time interval, then checks to see whether the body at its new position intersects other bodies.

  • With continuous collision detection, SceneKit calculates the volume that will be traversed by a body during each frame, then checks to see whether that volume intersects other bodies. This property's value defaults to 0.0, resulting in discrete collision detection at all times. When this value is nonzero, SceneKit applies continuous collision whenever the body travels more than the specified distance within one timeStep.

离散碰撞检测提供了高性能,但对于小型、快速移动的物体可能会导致不准确的结果。连续碰撞检测具有性能成本并且仅适用于球形物理形状,但提供更准确的结果。

关于ios - SceneKit - 几何渗透,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55757715/

相关文章:

ios - 如何暂停 NSOperationQueue 中的 NSOperation?

ios - 在 iOS 设备上测试时 Unity 游戏滞后

database - unity 使用 SQLite 数据库构建 webGL

swift - 在函数中使用 ARKit 来更改 SCNNode 会使应用程序停止运行

swift - SceneKit 中的 SCNShadable 将 float 组传递给着色器修改器

ios - 如何更新 NSMutableDictionary 中的 NSMutableArray 值

iphone - NSException 在 iPhone 应用中的使用

iphone - iOS iPhone GKSession 在后台发现

c# - 游戏开发 xna/unity3d

swift - SceneKit 中的低帧率