Dark Castle
Dark Castle

Reputation: 1299

Scenekit ConcavePolyhedron body shape on SCNTorus - strange effects on physics

I'm working on a simple ring toss game where SCNToruses are pushed towards a vertical rod. I'd like them to collide with eachother, be affected by forces and gravity fields and also be able to fall around the rod.

When using ConvexHull, the boundary on the torus looks good but the inner area is part of the collider so the torus will not go around a rod. Otherwise the physics forces look good. ConvexHull on Toruses

When using a ConcavePolyhedron, the boundary on the torus has a hole in the center and allows the torus to go around the rod. The problem is that when I use concave polyhedron, the rest of the physics stuff does not work so well. Rings do not collide with eachother and when a force is applied at an offset, let's say (.5, .5, .5), the torus does not rotate, it stays as it was created. ConcavePolyhedron on Toruses

Is there any way to achieve both of these affects so that I can model a ring toss game using basic physics?

Upvotes: 1

Views: 445

Answers (1)

Dark Castle
Dark Castle

Reputation: 1299

I believe that the issue here is that the concavePolyhedron SCNPhysicsShape.ShapeType must be a static physics body which means that it cannot react to forces:

https://developer.apple.com/documentation/scenekit/scnphysicsshape.shapetype/1508890-concavepolyhedron

This shape type may only be used for static physics bodies (that is, those whose type property is static)

I know that this shapetype is very inefficient anyway so I'm going to go with surrounding the torus with small cylindrical nodes.

Upvotes: 2

Related Questions