setup:
Perspective camera with position (0, 0, 200 ) and rotation (22.5, 0, 0)
Using rendercam.follow() on any game object places it at the bottom of the screen, centered on X. It works fine if you zero out the rotation. Zoom works perfect, zooming into the center of the display either way. How do I get it to center the followed object in the display regardless of X rotation? I obviously need to offset Y but unsure if there is something I’m missing in the module to do it, or I need to modify/add to what is there. I tried to shoehorn the line for projection from the zoom function and it didn’t help.
Sorry if this has been asked before, I searched quiet a bit and didn’t see anything on perspective cameras with this problem using rendercam.
Yeah, the follow function moves the camera towards the X and Y of the followed object, so it doesn’t really work for cameras that are rotated on the X or Y axis. There is a note about that in the documentation.
Based on your screenshot, I suggest you make your own small script to follow an object based on X and Y, and then make your camera a child of the object with that script. That would be pretty simple and let you adjust the camera angle and offset pretty easily.
To get a correct, framerate-independent follow position, use this calculation:
Thanks for the reply and suggestion. I saw your notes in the documentation when I started working on the camera and made a work-around similar to what you suggested, but wanted to see if there was a way to do everything with rendercam.
How I got around it was to make a blank game object called “selected” and had it go to where was selected in the game world. The camera was child of that object and followed it. Finding the correct Y offset for the camera was done with rendercam.world_to_screen().