sinio
sinio

Reputation: 711

SpriteKit: How to stop stack of nodes weighing down as more nodes are added?

I'm creating a game where the user stacks nodes using SKPhysicsJointLimit. This works, but the more nodes that are added to the stack, the more "weighed down" the stack gets and it becomes slower to move.

I get this behaviour is modelled after physics, but how do I make it so the stack continues moving normally and isn't weighed down?

Upvotes: 0

Views: 60

Answers (1)

Steve Ives
Steve Ives

Reputation: 8134

The game engine is trying to model the physics as accurately as possible, and if the item gets heavier then being slower to move is just natural.

To counter this, you can make the stack lighter, by changing the density of the objects in the stack, via the density property of their physics bodies (https://developer.apple.com/documentation/spritekit/skphysicsbody/1519983-density) or you could reduce the gravity in the scene (https://developer.apple.com/documentation/spritekit/skphysicsworld/1449623-gravity) but this will obviously affect everything.

Upvotes: 1

Related Questions