[SOLVED] Camera doesn't work with object that has a force applied to it

It’s not a super easy problem to describe, but – I’m trying to make a custom on-screen joystick for a mobile game, where moving the joystick will move the player. The actual movement of the joystick works perfectly, and the way it moves the player is by applying a force to that player. However, once I add a camera to the mix, it kinda breaks everything.

I’ve done some testing, and I’ve narrowed it down to being the force applied to the player that creates issues. I’ve tested this with two events – one that applies a force to the player, and one that centers the camera on the player. To summarize my findings:

  • If the camera is centered on the player but is on a different layer (e.g. player on base layer, camera on background layer), the camera will follow the player, but for some reason the player will be a lot faster than the camera and will eventually go off screen.
  • If the camera is centered on the player and is on the same layer as the player, absolutely no movement will happen.

I’ve tried to follow a few joystick tutorials, but none of them involve camera movement, so I’m lost as to what I can do. Any insight or help would be appreciated.

What do you mean, no movement will happen? The player will stay in the middle of the screen and not appear to move, while all other object on the same layer as the player will move. To move objects on other layers, you’ll need to move the camera position on those too.

It may also help if you provide a screen snip of the camera position update events.

I didn’t even think that I needed to have cameras for different layers. Adding a second camera to move the background worked!

1 Like

Note - you don’t add cameras to layers. Each layer automatically has a camera - the default is camera 0.