Camera

Hi everyone,

I have some questions about the camera.

I use the build in Orthographic 2D Camera on an operator GO attached to the Player.

  1. Question how do i get the actual width and length. of the camera, i need this to know which coordinates the camera is projecting to add collision outside of the camera view. (delete bullets)

  2. Whenever i try to get information of the camera i get this:
    attempt to index upvalue ‘camera’ (a nil value) from:

game_state.projection =  camera.get_projection("/operator#camera")

The camera is working and all so where would i try to get this information at what stage of the Lifecycle?

  1. Should i save the values from the renderscript in a lua module so i can access them when i want? I did copy the original and safed it under my_render to manipulate it like this not sure if that is ok to do? I did read that the camera script is available in all script but i always get the nil value. So i cannot call it in the player init script? which is on the same Gamebobject than the Operator/Camera?

You are probably calling the function outside of the scope of a script lifecycle function. Try calling it from init()

I found the mistake… i had a local camera variable which had nil and did not see it.

i can see now the camera information it says zoom = 1 but i set the property manual to 2. is that normal?