Page 1 of 1

Scripting camera position.

Posted: Tue Feb 07, 2023 7:47 pm
by Rafiz
Is there way to change default camera behavior of just following player? I would like for camera to move when player cursor is close to screen border, so it extends his view in direction of where cursor is.

I know of controller [https://lua-api.factorio.com/latest/Lua ... controller] but I don't want cutscene controller, as it detaches control keys from character.

Right now I feel like it might be impossible to control camera in such way, but correct me if I'm wrong.

When I was searching for term "camera" on this forum I wasn't finding much interesting topics, so I decided to create my own.
There's this topic, but it got kinda derailed into different idea/solution [viewtopic.php?f=33&t=102659&p=569489&hi ... ra#p569489]

I'm making a mod that will feature quite long-distance weapons and extending player zoom isn't perfect, because a) it makes things smaller, b) most of screen isn't in point of interest.

I could make "aiming" mode when player would stand still, switch to cutscene controller and move camera freely while aiming, but I would more like it to be like in "dynamic" games, where you can shoot far, while moving... I mean player character is super hero anyways by virtue of running 30km/h all day long and shooting with 100% accuracy, right? :D

Re: Scripting camera position.

Posted: Tue Feb 07, 2023 11:04 pm
by Xorimuth
Moving the camera position is basically impossible. Cutscenes is one option, maybe there's some other hacky solution I hadn't considered...

A larger problem is that you can't read the player's cursor position. Or at least, you can, but only in response to a CustomInput (i.e. when the player clicks or presses a key) https://lua-api.factorio.com/latest/eve ... InputEvent.

Re: Scripting camera position.

Posted: Tue Feb 07, 2023 11:42 pm
by Rafiz
Ooh, yeah.. Cursor was also problem in my considerations... So it seems it's "very" impossible with current API...