I installed SKConstraint to restrict my camera to my node player, as described here . I use SKRange(upperLimit:) for this restriction so that the player can move within this range without causing the camera to move. If a player goes beyond this range, the camera will move to follow him.
The problem is that the camera moves quickly and immediately to follow it. But my game design requires that the camera first starts following it slowly. Then, as he continues to move beyond the range of limits, the camera will accelerate to follow him faster.
Is there any way to achieve this behavior? SKConstraint seems rather inflexible in this regard. It would be nice if it is capable of more dynamic behavior ... something like the effect of a "rubber band" between limited objects: the restriction is applied weakly if the target range is exceeded by a small amount and applied strongly if the range is exceeded by a lot.
I tried to set the constraint enabled property to false for 10 frames and then true for 1 frame in the update method to see if this could delay the restriction to take effect. But this only makes the camera inexorably follow the player. Not the result I was hoping for.
I donβt see a direct way to do this with SKConstraint , so I may have to create my own custom constraint behavior to achieve this effect.
source share