|Topic was automatically imported from the old Question2Answer platform.
First of all, hi!
I’m new to this engine, but have been using GMS for some time. I searched for a couple of days, and have not found my answer anywhere on the internet.
My goal is to rotate the camera with the player, who’s walking in a top-down-shooter style [eg. Robotron2084]. I want the player to appear stationary relative to camera.
So in a sense use look_at() to follow the mouse pointer. I can do it with buttons, like A and D to rotate a camera. But that’s not the point. I also tried using calculated angles to add or subtract to the player and camera rotation (based on get_last_mouse_speed < or > 0). But it was really glitchy, I must have been doing something wrong.
Here’s my scene hierarchy. The camera follows the player via the script.
Here’s my poor visual representation, I apologise for the bad photoshop. I hope it helps.
I probably missed some vital detail, if I did please let me know. Thanks in advance!
Is there any reason you can’t have the camera as the child of the player? It will be able to rotate automatically that way.
exuin | 2021-09-03 19:16
Unfortunately when I do that it constantly spins around. I use
look_at(get_global_mouse_position()) on player script to rotate him.
dregent | 2021-09-03 20:57