Jump to content

A way to remove the camera jolt when hitting head?


Recommended Posts

Title says it all. It's annoying as hell and one reason I don't get parkour. I've tried searching for a mod, or others talking about it. Always just gives me results for other camera problems. I'm not even sure what to look for in the xml's to try and change it. Don't want anything special just remove the 45 degree tilt the camera does as its disorientating and I swear makes you move to the side as well.

Link to comment
Share on other sites

It looks like the camera jolt for head impact is hardcoded into the game. It's mainly controlled by the vp_FPCamera.OnMessage_HeadImpact() handler, which is triggered whenever the player takes damage or on an upward collision. I don't believe an XML mod has the capability of changing this, but a C# mod can. Here is proof of concept that should do the trick.

 

PoC:

Spoiler
using HarmonyLib;
using System.Reflection;

/* .NET Framework 4.5
 * 
 * References:
 *  - 0Harmony.dll
 *  - Assembly-CSharp.dll
 *  - LogLibrary.dll
 */

public class PeskyCameraJolt : IModApi
{
    public void InitMod(Mod _modInstance)
    {
        Harmony harmony = new Harmony(base.GetType().ToString());
        harmony.PatchAll(Assembly.GetExecutingAssembly());

        Log.Out("[MODS] [PeskyCameraJolt] Loaded!");
    }

}

[HarmonyPatch(typeof(vp_FPCamera), "OnMessage_HeadImpact")]
class HeadImpactPatch
{
    static bool Prefix(float impact)
    {
        if (GameManager.Instance.World.GetPrimaryPlayer().vp_FPController.HeadContact) // Only skip head impact when there is head contact (i.e. collision)
        {
            return false;
        }
        return true;
    }
}

 

 

Compiled version (A21): https://drive.google.com/file/d/1JTLliaC0uYWvgMBfK0D0Z7_4Z6Q4H6wG

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
×
×
  • Create New...