Limiting rotation of an object on a spring arm
I am desperate for an answer to this problem. We are working on a rapid prototype and time is of the essence.
I have a player controller and a camera on that controller. On the camera, I have attached a spring arm and then onto that, I have attached a helmet which simulates first person with some nice delay so it looks like you’re moving your eyes around in the helmet, too.
Here is where I run into issues. When I rotate the camera very quickly, I can see too far to the left and to the right. Normally, I would be able to fix this by simply limiting the angle but with the springarm, this becomes problematic as it’s left up to the springarm to decide what to do. For one, the local rotation of the helmet is always returned as a fixed number as I guess the spring arm sets it to that. If I get the delta rotator between the helmet and the camera, I get an actual result but the problem is in limiting that value and having it look smooth.
I have tried other things, too. I have tried making it so the further the helmet is from the center of the screen, the higher the lag, meaning it should snap back quicker. I interpolate between the values but this causes extreme stuttering.
I really want to use a spring arm as it’s perfect for the effect I want but for the life of me I can’t figure this out. If only there was a min/max yaw or something similar.
I have even dug into the SpringArmComponent.cpp but haven’t found out exactly where I would insert the limitation code.
Can anyone spare a moment and help out with this? It would be so very much appreciated. This has been a blocker for a few days now.