Jump to a different Camera

I know I have done this before but I can’t remember. I also recall there being a block in blockly to switch cameras, but can’t find it. I want the view to switch to a different camera when I click on a certain item. Is there Java I can use in the coding block for this?

Hi Brian,

this should work:

  1. Make sure that your cameras have unique names and are enabled for Blockly.

  1. Create a variable for each camera and assign the appropriate camera item to them. Then use these variable names in the “Coding” blocks and call the .focusOn(true) method on them.

cams2

  1. Result in Play mode:

5 Likes

Hi, I’m trying to use this same method in my project but I’m afraid it doesn’t work for me. Here is what I have done so far:

when I click on the lion, the camera switches but you are at a fixed position and can’t look around.

Please reply soon.

Hi @s0p1!

Make sure that your cameras are no parented to other items when you switch them; detach them if possible. Keep in mind that cameras will retain the camera mode you set them to while you build your scene.

You can also share the space with us to so we can see what’s wrong.