Physics on objects in SceneKit, when did it reach the end position?

Hi,

for the first time I am trying to make a game using 3d and Physics in SceneKit. I thought I start simple with a game of dice, and all goes well except for one thing: if I throw the dice, and the roll around by the physics and stuff… how do I know when all dice are done rolling around? I want to allow user input only when the dice are done rolling, but I cannot figure out when that is. Is there something like ‘sleep’ and ‘awake’ that indicates whether the dice have reached a stable end position?
Maybe it’s me, but I cannot find any pointers on the web.

Thanks!

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

Hi there,

You can inspect the SCNPhysicsBody, it has an isResting property that will tell you exactly what you’re looking for.

Here’s the link to the documentation: SCNPhysicsBody.isResting

This topic was automatically closed after 166 days. New replies are no longer allowed.