I'm trying to make a game where you control a platform by moving it left and right while trying to balance falling objects on top of it. However, it seems like the platform moves independently of the items that fall on top of it. For example, if a block falls on top of my platform, when I move the platform left or right, the block stays still and only the platform moves underneath it. This makes it impossible to stack anything since the blocks are not moving with the platform. I'm not sure what SpriteKit physics properties I need to use to simulate balancing. I tried fiddling with restitution for bounciness when the blocks collide with the platform, and friction property to see if that helps the blocks "stick" to the platform, but that doesn't seem to help either.
My platform wasn't dynamic, so I tried setting
platform.physicsBody!.isDynamic = true
platform.physicsBody!.affectedByGravity = false
platform.physicsBody!.allowsRotation = false
Which seems to help? but the platform still moves around when it collides with the blocks which I can't have.
EDIT:
This is how I'm moving the platform. The user moves the platforms parent by dragging it around with your finger. Since this moves the platforms parent, the platform moves with it.
override func touchesMoved(touches: Set<UITouch>, withEvent event: UIEvent?) {
if let touch = touches.first {
let location = touch.locationInNode(self)
platformParent.position.x = location.x
}
}