Teleporting to New Location on Click

I’ve created a space for my students to fill as a museum. I have a directory of exhibits using text panels at the start of the space and would like for visitors to be able to click on one of the panels and be “teleported” to another position within the same space. I’ve tried to figure it out using the forums here but don’t have a great understanding of Java and don’t see a prebuilt command in Blocks that will work. Ideally there would be an action that would look something like: “set position of ____ to X: __ Y: __ Z: __”. I would then make the Camera my object and set its position using the X, Y, and Z coordinates. Does anyone know the best way to do this?

I know some about paths but haven’t been able to get them to look like I want them to, and I have seen a suggestion to jump to different cameras but don’t honestly know how to do the Java stuff necessary to make that work.

Thank you for the help!

Hi @maxgorham,

You can achieve easy camera switching in our visual coding language CoBlocks, with no Java knowledge required :slight_smile:. Here’s how:

First, let’s create a new CoBlocks script and add the Camera item to CoBlocks. Let’s also make a copy of the camera item so we can switch to it.

To control when to switch to the different cameras, let’s add two more characters from our library and add them to CoBlocks. Then, we add two when item clicked - CoBlocks to the white workspace. Inside of these blocks, we use a switch to camera - CoBlock and select the camera we want to switch to.

Let’s press Play to see our code in action! Now, whenever we click one of the characters, we switch to another camera :slight_smile:

Hope that this helps you getting started. If you want to learn more about using CoBlocks, head over to our tutorial forum for more!

2 Likes

You are awesome. Thank you. The problem was that I didn’t have the advanced blocks enabled in my settings so I didn’t even know that one existed. Much appreciated.

1 Like

Glad to be of help! Happy CoSpacing :smiley:

1 Like