Jump to content

ugmoe

Members
  • Posts

    3
  • Joined

  • Last visited

ugmoe's Achievements

  1. here is the function for mouse smoothing: https://pastebin.com/LUSnPfat aMouse = raw mouse input DeltaTime = real world time between previous and current tick (seconds) TimeDilation = in game time between previous and current tick (seconds) SampleCount = number of samples between previous and current tick (seconds/sample) Just looking at this function, it shouldn't cause any problems, but there is one possibility. They added a framerate check at the beginning to see if the user's framerate drops below 4fps. If this check fails, it stops the smoothing "so it doesn't distort the results". It could be possible that the framerate drops and distorts the results but doesnt trigger the 4fps check. So like, it could drop to 5 fps and smoothing would not get disabled. I think the real culprit here is "Smooth Framerate" which is also in project settings but is not on by default. I'm guessing some developers turn it on while others dont and this somehow messes up the DeltaTime calculations, which this whole function is based on. I'm going to mess with all the settings and try to reproduce this problem. If i'm able to reproduce it, I could submit this as a bug report and it would almost certainly get fixed at some point, theyre really good about fixing bugs. For any UE4 developers that see this, I made a blueprint script that lets players enter their desired inches/360 and DPI, and gives them their sensitivity: https://blueprintue.com/blueprint/tqbz02_t/
  2. here is the function for mouse smoothing: aMouse = raw mouse input DeltaTime = real world time between previous and current tick (seconds) TimeDilation = in game time between previous and current tick (seconds) SampleCount = number of samples between previous and current tick (seconds/sample) void UPlayerInput::ClearSmoothing() { for ( int32 i=0; i<2; i++ ) { ZeroTime[i] = 0.f; SmoothedMouse[i] = 0.f; } const UPlayerInput* DefaultPlayerInput = GetDefault<UPlayerInput>(); MouseSamplingTotal = DefaultPlayerInput->MouseSamplingTotal; MouseSamples = DefaultPlayerInput->MouseSamples; } float UPlayerInput::SmoothMouse(float aMouse, uint8& SampleCount, int32 Index) { check(Index >= 0); check(Index < UE_ARRAY_COUNT(ZeroTime)); UWorld* World = GetWorld(); if (World) { check(World->GetWorldSettings()); const float EffectiveTimeDilation = World->GetWorldSettings()->GetEffectiveTimeDilation(); if (EffectiveTimeDilation != LastTimeDilation) { LastTimeDilation = EffectiveTimeDilation; ClearSmoothing(); } } const float DeltaTime = FApp::GetDeltaTime(); if (DeltaTime < 0.25f) { check(MouseSamples > 0); // this is seconds/sample const float MouseSamplingTime = MouseSamplingTotal/MouseSamples; check(MouseSamplingTime > 0.0f); if ( aMouse == 0 ) { // no mouse movement received ZeroTime[Index] += DeltaTime; // increment length of time we've been at zero if ( ZeroTime[Index] < MouseSamplingTime ) { // zero mouse movement is possibly because less than the mouse sampling interval has passed aMouse = SmoothedMouse[Index] * DeltaTime/MouseSamplingTime; } else { SmoothedMouse[Index] = 0; } } else { ZeroTime[Index] = 0; if ( SmoothedMouse[Index] != 0 ) { // this isn't the first tick with non-zero mouse movement if ( DeltaTime < MouseSamplingTime * (SampleCount + 1) ) { check(SampleCount > 0); // smooth mouse movement so samples/tick is constant aMouse = aMouse * DeltaTime/(MouseSamplingTime * SampleCount); } else { // fewer samples, so going slow // use number of samples we should have had for sample count SampleCount = DeltaTime/MouseSamplingTime; } } check(SampleCount >= 0); if (SampleCount == 0) { SmoothedMouse[Index] = 0; } else { SmoothedMouse[Index] = aMouse/SampleCount; } } } else { // if we had an abnormally long frame, clear everything so it doesn't distort the results ClearSmoothing(); } SampleCount = 0; return aMouse; }
×
×
  • Create New...