Different Rotation Speeds per Weapon

wInevitable

New member
I'm encountering an issue where my character rotates at different speeds with different weapons equipped, but cannot determine the root cause.

For example, it will take me 16 inches to rotate 360 degrees with the Assault Rifle, but only 13 inches when I equip the Shotgun. In both cases, I am aiming from the hip and just moving the mouse left to right with the same X sensitivity and mouse DPI. I've even set the Y sensitivity to 0 to eliminate vertical movement in case that could be affecting this. The Look Vector Mode is set to Smoothed.

I can't track down what is causing this. Pretty sure I have mouse acceleration disabled. This happens in both 1st and 3rd person. Where is the rotation speed calculated? I've placed a few debuggers but don't see any discrepancies so far and could use some guidance on how to track this down.

Thanks!
 
Does it work correctly in the demo scene?

The rotation speed is controlled by the PlayerInput class, with GetLookVector returning the actual look rotation value to the View Type. The View Type then rotates the character and depending on which View/Movement type that character will then rotate accordingly.
 
This does not happen in the demo scene. I also tried abstracting Nolan to a prefab and placing that in the game scene where this is happening and still see the same behavior. Seems like that points to an external force affecting the rotation speed? Could this be camera-related? Or a script? I've commented out any scripts referencing the PlayerInput class in my code, but that doesn't help.

I also tested with Raw input vs Smoothed and see the same behavior.
 
Also, how do you completely eliminate the visual bob effect? I'd like to get rid of that while testing. Still not able to figure out the cause though
 
Seems like that points to an external force affecting the rotation speed? Could this be camera-related?
It does sound like it could be camera related. The character follows the camera rotation so if that camera rotation. You should also bring the camera over to your new scene to test that.

Also, how do you completely eliminate the visual bob effect?
Take a look at this page: https://opsive.com/support/document.../view-types/included-view-types/first-person/
 
It looks like it's the environment that's disrupting the rotation speed. I'm using Gaia, Enviro, Aquas and CTS.

When I add the Character/Scene items to an empty scene with just a 3D plane the rotation is fine. I added a Gaia terrain to that and the rotation speed was disrupted again. So, I destroyed the Opsive components, re-added them and the rotation seemed fine, but further testing reproduces the issue.

Now I'm trying to figure out how to make it work with the other libraries -- destroying and re-initializing the Opsive components doesn't seem to work. It's really not clear what is causing the issue. Why would auto-generating a terrain in a scene with an Opsive character disrupt the rotation? It was just a terrain object nothing else.
 
You are likely CPU or GPU bound. If you profile your game you should be able to start taking steps to determine what is causing the bottleneck.
 
Thanks for the suggestion, but I checked the profiler and don't see an issue there.

This is a single piece of terrain, the smallest Gaia can generate. No textures, other libraries, etc, and the GPU usage is about the same (~25%) as when using the simple 3D plane. The profiler is reading between 250-1000 FPS and CPU usage is at about the same 25% mark. These usage levels are very close to the Demo Scene with CPU usage actually higher in the Demo Scene though GPU is as low as 13%.

Now, when I load a full environment GPU usage does spike to 80-90%, CPU to ~40%, but I've been testing this in a test scene with very few assets to try to isolate the cause. Furthermore, the effect persists after I remove the terrain from the scene. That is, I still see different turning rates for different weapons.

In fact, I just checked the Demo Scene and I'm seeing the effect there now. I run up the stairs to the ranged weapon room and pick up everything. Then, I'm testing 360 rotations with each. Lower DPIs exaggerate the effect. 23-24 inches for the Shotgun vs 15-15.5 inches for the AR at 400 DPI as an example.

Oddly, I haven't seen a difference in the Y axis movement, but I haven't tested that as thoroughly.
 
Also, it seems like there are 3 groups: the Assault Rifle, the Sniper Rifle and everything else. Pistol, Duel Pistols, Shotgun and Rocket Launcher all seem to have the same rotation speed, but the AR and SR are distinct. I tried re-importing the project and still have the same issue
 
Could it be related to this? Though this code is in the latest version.


Beyond that have you tried a built executable?
 
Yeah, the code I have locally already has that:
C#:
m_CurrentLookVector.x *= (m_LookSensitivity.x + lookAcceleration) * TimeUtility.FramerateDeltaTime;
m_CurrentLookVector.y *= (m_LookSensitivity.y + lookAcceleration) * TimeUtility.FramerateDeltaTime;

I tried the other fix the user mentioned there about overwriting the SetcameraLookVectorInternal function, but that didn't help either.

As far as a built executable, that's how this all came to my attention. I had a user of my game specifically call this out.

I did just try disabling the AR/SR scope cameras when not aiming and that appears to have fixed the AR rotation speed, but not the SR. Strange, the SR consistently rotates about 28.5% faster.

Also, since updating to the new version, I've noticed some wonky behavior with the Sniper scope that could be related. The Fullscreen UI kicks in, but then you can see the gun scope sliding into place behind it just the like AR does. Before the update, the Sniper would just use the Fullscreen UI and the gun scope model was not visible while aiming. Can I switch this back to the way it was before where the model was hidden while aiming the Sniper Rifle?
 
I did just try disabling the AR/SR scope cameras when not aiming and that appears to have fixed the AR rotation speed, but not the SR. Strange, the SR consistently rotates about 28.5% faster.
A definitive way to debug this would be to place a breakpoint within CharacterLocomotion.ApplyRotation and look at the rotation delta each frame. From there you can debug up the chain to see what variable is not constant as the frames progress.
 
Top