Question

How can I create a concave SKPhysicsBody?

My guess is to create a composite node that consists of multiple convex bodies. Can I "stick" them any other way that create an SKPhysicsJointFixed between each?

Était-ce utile?

La solution

You may want to wait a short while - I can't say it explicitly, but there's an intriguing new SKPhysicsBody method if you look at pre-release docs at developer.apple.com and search for "iOS 7.1 API Diffs".


There is another way - you can simply create new SKNodes, add your new nodes as the children of your target composite node, and attach convex SKPhysicsBodies to these child nodes.
EDIT: this will only work for non-dynamic constituent bodies, if you just want to detect contact/collision on a concave composite one that's static.

Autres conseils

Create two or more SKPhysicsBody variables using convex paths, then create a union of these paths using the initializer SKPhysicsBody.bodyWithBodies. This union can be concave.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top