Blockly Coding - How to Make the Floor Move the Camera


#1

I was wondering how to use Blockly to make the floor rise at a relatively moderate pace, but at the same time send the camera to a specific location if it happens to touch the rising floor.

Thanks for the help!


#2

Hi Oscar,

The floor cannot be coded as it is built into the environment/space. You could however use the building blocks and code them to move upward. Could you perhaps send across an example of what you would like to achieve exactly?

Thanks,


#3

Thanks for replying!

How would I make it so that if the camera falls and touches the black floor, it reappears not on the top block, but on the block under it?


#4

I played with this a bit and I am sure @Benny could do this more efficiently than I can, but you would set it up so that when the camera touches. Something like this might work (upon collision)the floor it moves to the x,y,z (0,-.75,12 on the one I built really quickly) coordinates that would be directly above the lower block. floor code)

Though for some reason my collision mode isn’t working at the beginning so I just keep falling through the blocks as I jump up to the 2nd block repeatedly.(Moving forward first because the camera would just collide with the underside of the bottom block.)


#5

Thanks for the reply!


#6

Hi Oscar,

you can also use the “on update” event to check for a certain condition for every frame. In your case it could look something like this.

Here we check if the z-position of the camera is less then 2 (means you fell down to the ground basically) and then set a new position for the camera.