Chapter 6. Dice falling through the plane

Hi,

After implementing Plane physics in Chapter 6, very often dice falling through the plane or several dice falling through the plane and several stayed on the plane.

It also happens in final tutorial project .

@chrislanguage Can you please help with this when you get a chance? Thank you - much appreciated! :]

Issue can be fixed using of continuousCollisionDetectionThreshold:

For example, in a game involving projectiles and targets, a small projectile may pass through a target if it moves farther than the target’s thickness within one time step. By setting the projectile’s continuousCollisionDetectionThreshold to match its diameter, you ensure that SceneKit always detects collisions between the projectile and other objects.

func throwDiceNode(transform: SCNMatrix4, offset: SCNVector3) {
   ...

   if #available(iOS 12.0, *) {
      diceNode.physicsBody?.continuousCollisionDetectionThreshold = 0.04
   }
        
   sceneView.scene.rootNode.addChildNode(diceNode)
}

@sergeydi Thank you for sharing your solution - much appreciated! :]

My solution is incorrect. It can be used only with spherical physics shapes.

So, issue is still unsolved…

@sergeydi Do you still have issues with this?

Hi, I still have issues with his. Redid numerous times and still fall through

Ok, closed Xcode, delete app of iPad… had a snack to compose myself. Restarted and rebuilt now dice no longer fall through… no idea why but at least it works now.

@zoran Really glad you sorted it out! Cheers! :]