Scripting camera position.

Place to get help with not working mods / modding interface.
Post Reply
Rafiz
Inserter
Inserter
Posts: 31
Joined: Sun Jan 17, 2021 9:28 am
Contact:

Scripting camera position.

Post 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

Xorimuth
Filter Inserter
Filter Inserter
Posts: 624
Joined: Sat Mar 02, 2019 9:39 pm
Contact:

Re: Scripting camera position.

Post 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.
My mods
Content: Freight Forwarding | Spidertron Patrols | Spidertron Enhancements | Power Overload
QoL: Factory Search | Remote Configuration | Module Inserter Simplified | Wire Shortcuts X | Ghost Warnings

Rafiz
Inserter
Inserter
Posts: 31
Joined: Sun Jan 17, 2021 9:28 am
Contact:

Re: Scripting camera position.

Post by Rafiz »

Ooh, yeah.. Cursor was also problem in my considerations... So it seems it's "very" impossible with current API...

Post Reply

Return to “Modding help”