2 Cameras move together but switch back and forth

I have a student who has created a room that has a glass plate in the center. The student would like the ‘player’ to be able to move along the top of the room and click on a letter (C) to move around at the bottom of the room and then back to the top again. The student would like the cameras to basically follow each other so you are in the same area (x axis) of the room no matter whether you are at the top or bottom of the room.
We’ve used this space to experiment. CoSpaces Edu :: 2 Cameras - switch between and move


Madonna Davis


Hi @TechWarriors, there’s a very easy solution to your problem: use one camera, and simply change vertical position (Z axis) of the camera.

Hope that helps! Let me know if you have any further questions about this. If this solves your problem, please mark this post as the Solution.

Many thanks,
Geoff @ TechLeap

PS: run parallel is not needed with event blocks - these event listeners are ALWAYS listening, waiting for an event to occur.

Hi Guru Ambassador,
Can you elaborate on how I change only the vertical position of the camera and keep the X and Y the same?

Tech Warriors

In CoBlocks, you can use:

  • set position of Item to XYZ +
  • x of XYZ +
  • position of Item


The code above works. Now my only problem is if the player holds down the ‘s’ key too long they end up out of the building. Is there any way to stop that?

So are you saying that you need some kind of conditional check to test whether the camera is at the maximum height you want, and only change it if it isn’t?

Or are you saying that you want to set the z-index to a fixed height?

These 2 questions give you your answer. Let me know if you are unsure how to proceed.

Guru Ambassador,
Once again…you’ve come through. Thank you for your help and guiding me to the solution. Here is the link in case anyone out there has the same question.

-Tech Warriors

1 Like