Messages to render Script for camera projection is not working for me

HI,

I wanted to try to change the Camera projection from script with:

msg.post("@render:", "use_fixed_projection", { near = -1, far = 1, zoom = 4 })

I use the default render script to try this out but nothing happens. I tried the other projections with the message aswell, but it always stays the same.

I call this from the player script on the character which will spawn from a collectionfactory. That Gameobject “player” has the camera on it.

I tried send this message from the main script aswell but nothing happens.

I can change the Zoom on my orthographic 2D camera and it works and all is zoomed, but when I try the same over msg.post() nothing happens.

What do i miss here?

If you have active camera components in your collection(s), they will automatically take precedence over projections passed in via messages. If you want to override this behaviour, you can either disable all the cameras and then use messages or render.set_projection OR you can adjust parameters on the camera directly via the camera API: API reference (camera)

2 Likes

Ok i tested it and yes i see now. Without the camera everything works. So for a 2D game it makes more sense use the camera and then change the setting on it I assume?

Thank you

1 Like