Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Camera Detection #1

Open
XertroV opened this issue Apr 14, 2023 · 0 comments · May be fixed by #2
Open

Camera Detection #1

XertroV opened this issue Apr 14, 2023 · 0 comments · May be fixed by #2

Comments

@XertroV
Copy link

XertroV commented Apr 14, 2023

This is about detecting which cam the user has active, currently, and to see if you have any suggestions/feedback atm. The method has some limitations (such as not detecting custom cameras in in-game mediatracker tracks), but otherwise seems to be reliable and can detect a wide variety of cams.

It's run on each frame in the RenderEarly call, so if it ever crashes the game I should know about it.
It sets a global variable of the ActiveCam type (see below).

It works by getting a pointer near GameScene to some kind of outer camera manager nod. This nod has pointers to 2 objects that are important: camera models, and camera controls.

  • The first are of types: CPlugVehicleCameraRace2Model, CPlugVehicleCameraRace3Model, CPlugVehicleCameraInternalModel and I have a seemly-reliable way to tell if they're alt cams or not (so this branch covers cams 1 through 6).
  • The second are types like CGameControlCameraFree and CGameControlCameraEditorOrbital. If the first nod is null, then I check this. (We could check for CGameControlCameraTrackManiaRace2 etc here too, but IDK if we can tell if it's the alt cam or not from those nods).

Right now, I've added support for:

shared enum ActiveCam {
    None = 0,
    Cam1 = 1,
    Cam2 = 2,
    Cam3 = 3,
    Cam1Alt = 4,
    Cam2Alt = 5,
    Cam3Alt = 6,
    FreeCam = 7,
    EditorOrbital,
    Orbital3d,
    Helico,
    HmdExternal,
    ThirdPerson,
    FirstPerson,
    Target,
    Cam0,
    Other,
    Loading
}

None is used in menus and when there is no camera manager object thing.

Loading is for when all the pointers are null (often when loading a map or the editor).

Cam0 is the Race1 camera type, but I've never seen it.

@XertroV XertroV linked a pull request Apr 21, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant