Jump to content
    1. Welcome to GTAForums!

    1. GTANet.com

    1. GTA Online

      1. Los Santos Drug Wars
      2. Updates
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    2. Red Dead Online

      1. Blood Money
      2. Frontier Pursuits
      3. Find Lobbies & Outlaws
      4. Help & Support
    3. Crews

    1. Grand Theft Auto Series

      1. Bugs*
      2. St. Andrews Cathedral
    2. GTA VI

    3. GTA V

      1. Guides & Strategies
      2. Help & Support
    4. GTA IV

      1. The Lost and Damned
      2. The Ballad of Gay Tony
      3. Guides & Strategies
      4. Help & Support
    5. GTA San Andreas

      1. Classic GTA SA
      2. Guides & Strategies
      3. Help & Support
    6. GTA Vice City

      1. Classic GTA VC
      2. Guides & Strategies
      3. Help & Support
    7. GTA III

      1. Classic GTA III
      2. Guides & Strategies
      3. Help & Support
    8. Portable Games

      1. GTA Chinatown Wars
      2. GTA Vice City Stories
      3. GTA Liberty City Stories
    9. Top-Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    1. Red Dead Redemption 2

      1. PC
      2. Help & Support
    2. Red Dead Redemption

    1. GTA Mods

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Red Dead Mods

      1. Documentation
    3. Mod Showroom

      1. Scripts & Plugins
      2. Maps
      3. Total Conversions
      4. Vehicles
      5. Textures
      6. Characters
      7. Tools
      8. Other
      9. Workshop
    4. Featured Mods

      1. Design Your Own Mission
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Rockstar Games

    2. Rockstar Collectors

    1. Off-Topic

      1. General Chat
      2. Gaming
      3. Technology
      4. Movies & TV
      5. Music
      6. Sports
      7. Vehicles
    2. Expression

      1. Graphics / Visual Arts
      2. GFX Requests & Tutorials
      3. Writers' Discussion
      4. Debates & Discussion
    1. Announcements

    2. Support

    3. Suggestions

Happy Holidays from the GTANet team!

[C#] Can you disable, block or cancel the annoying FPV "Looking around" camera view.


LeeC22
 Share

Recommended Posts

You know when the player has been stood idle for a while, it switches to that annoying first-person view where it decides to look at random things. I am trying (and failing) to prevent that happening.

 

I thought it might be switching to first-person cam, so I tried _DISABLE_FIRST_PERSON_CAM_THIS_FRAME, which didn't work.

Then I thought it might be a Gameplay hint, so I tried checking IS_GAMEPLAY_HINT_ACTIVE, which always returned false, so it wasn't that.

My final thought was to check GameplayCamera.IsRendering, which shows false when it switches to that mode. I could simply reset to the gameplay camera when it happens but that would screw up every cinematic camera type mod I have created, which isn't very good.

 

So all those have failed miserably. I have searched for "idle", to see if it's an idle activity but can't find anything. I searched for "since" as I thought it might have been a TIME_SINCE_INPUT etc... thing but it isn't.

 

Does anyone have any idea what might be driving this switch to an alternate camera, and possibly a way to prevent it?

 

Even if it means editing a gamefile, I don't mind because this mode is just downright annoying when you're trying to test code. I mean, if all comes to all, I could probably write a small standalone mod that keeps track of how long it has been since any kind of input, and then pinging a controller input with a small value... but that's such a hack and it means testing every single controller input every frame, or few frames... unless I just did camera controls and movement controls, that would probably work.

  • Like 1
Link to comment
Share on other sites

I decided to go with the input manipulation for now, just to stop this view from kicking in. I have a List<Control> of the controls to check and a counter variable;

private int NoInputTimer;

private List<Control> CheckControlsList = new List<Control>() { Control.MoveLeftRight, Control.MoveUpDown, Control.LookLeftRight, Control.LookUpDown };

Then I have this function that is called each frame with the elapsed time being passed from the onTick() handler. I always calculate the elapsed time in onTick and then pass it to each function that requires it.

private void CheckControls(int elapsedTime)
{
    // Set a flag to false
    bool isPressed = false;

    // Go through each control in the List<Control> collection
    foreach (Control c in CheckControlsList)
    {
        // check to see if the Math.Abs(input normal) > .1f
        if (Math.Abs(Game.GetControlNormal(2, c)) > .1f || Math.Abs(Game.GetDisabledControlNormal(2, c)) > .1f)
        {
            // if so, set the flag to true and stop checking as any kind of input is good enough
            isPressed = true;
            break;
        }
    }

    // If the flag is still false, no control is pressed
    if (!isPressed)
    {
        // Increment the nothing-pressed timer
        NoInputTimer += elapsedTime;

        // if it has been longer than 25 seconds (Look around mode kicks in at about 31 seconds on my PC)
        if (NoInputTimer >= 25000)
        {
            // Set the sprint control normal to 1f. If you are stood still, this will do nothing to the character, so it's a safe input
            // Setting the control to less than 1f didn't stop the look-around mode from kicking in.
            Game.SetControlNormal(2, Control.Sprint, 1f);

            // reset the no-input timer
            NoInputTimer = 0;
        }
    }
    else
    {
        // if something is pressed, reset the no input timer to zero
        NoInputTimer = 0;
    }

    // just prevents me from switching to FPV while cycling camera views
    Function.Call(Hash._DISABLE_FIRST_PERSON_CAM_THIS_FRAME);
}

It's not how I wanted to do it but it works, so if anyone else needs to do the same thing... there you go.

  • Like 1
Link to comment
Share on other sites

Jitnaught

Maybe this native? INVALIDATE_IDLE_CAM

Or this one _0x9E4CFFF989258472

Quote

Resets the idle camera timer. Calling this in a loop will disable the idle camera.

Examples:

  • Lua
Citizen.CreateThread(function() 
	while true do
		InvalidateIdleCam()
		N_0x9e4cfff989258472() --Disable the vehicle idle camera
		Wait(1000) --The idle camera activates after 30 second so we don't need to call this per frame
	end 
end)

 

 

Edited by Jitnaught
  • Like 2
Link to comment
Share on other sites

6 hours ago, Jitnaught said:

Maybe this native? INVALIDATE_IDLE_CAM

Or this one _0x9E4CFFF989258472

 

I searched for idle in what I presumed was the latest natives list and all I got was this:

static void SET_FACIAL_IDLE_ANIM_OVERRIDE(Ped ped, char* animName, char* animDict) { invoke<Void>(0xFFC24B988B938B38, ped, animName, animDict); } // 0xFFC24B988B938B38 0x9BA19C13
static void CLEAR_FACIAL_IDLE_ANIM_OVERRIDE(Ped ped) { invoke<Void>(0x726256CC1EEB182F, ped); } // 0x726256CC1EEB182F 0x5244F4E2
static void SET_TIME_IDLE_DROP(BOOL p0, BOOL p1) { invoke<Void>(0x9DFE13ECDC1EC196, p0, p1); } // 0x9DFE13ECDC1EC196 0x92302899
static void PLAYSTATS_IDLE_KICK(int time) { invoke<Void>(0x5DA3A8DE8CB6226F, time); } // 0x5DA3A8DE8CB6226F 0x9E2B9522

Thank you for finding that, makes things much easier than my method for sure.

 

Edit: I can't actually find the hash of that INVALIDATE_IDLE_CAM and I can't find that name in any list I can find... do you have the hash please? I thought it was FiveM but I am obviously wrong.

 

Edit: Found it: 0xF4F2C0D4EE209E20

Edited by LeeC22
  • Like 2
Link to comment
Share on other sites

Thanks... sorry for the late acknowledgement.

  • Like 2
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • 1 User Currently Viewing
    0 members, 0 Anonymous, 1 Guest

×
×
  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.