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?
this should work:
- Make sure that your cameras have unique names and are enabled for Blockly.
- 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.
- Result in Play mode:
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.
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.