Search code examples
swiftscenekitarkit

How to show the PhysicsBody outline in ARKit?


I have a class as below in arkit

class ViewController: UIViewController, ARSCNViewDelegate, 
                                        SCNPhysicsContactDelegate  {
    override func viewDidLoad() { }
}

The truly reason is in the link How to set SCNPhysicsBody or SCNPhysicsShape?

How to set it so I can see the PhysicsBody outline? Then I can debug to check if the SCNPhysicsShape is reasonable or not.


Solution

  • This option helps visualizing the physics shapes for nodes with attached SCNPhysicsBody objects:

    sceneView.debugOptions = [.showPhysicsShapes]