0
\$\begingroup\$

I wrote a script that would match all models to one size, no matter the original size of the source model. So now these models fit precisely in the scene, but unfortunately when I add SCNPhysicsBody to them (with SCNPhysicsShape), their colliders (shapes) are not scaled. They do not match the current size of a node.

How can I fix this?

\$\endgroup\$
0
\$\begingroup\$

The problem is that SCNPhysicsShape (and physics generally in SceneKit) does not actually respect node scale. It will not use the new scale, instead it will create a SCNPhysicsShape respecting the old scale of node.

But you can force to use the new scale.

Just create a physics body with nil (or null if you are using xamarin ios) for the shape parameter.

E.g.:

body = SCNPhysicsBody(node, nil)

or for xamarin ios

body = SCNPhysicsBody.Create(node, null)
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.