A different logic bug causing the gitters

My barrel gets the gitters!
ok, please follow along in my explanation - this talks about pitch, but the same happens with yaw at the same time:

  1. If you’re aiming up, close to where the aiming solution will fail, you want the barrel to rotate up to that spot.
  2. You are aiming at one spot in the scene and have not moved what you’re aiming at.
  3. You don’t want the barrel to go up too far to seem to point up into the air… so we clamp max elevation
  4. Once the barrel gets very close to its ‘limit’, imposed by clamp on max degrees, the next cycle will push beyond the limit - so then the ‘logic’ says, ok, rotate it down instead.
  5. next cycle; now you’re below again - so rotate up.
  6. Every successive frame will reverse the direction
  7. The result is that the barrel 'jitters’
    This happens in 4.16.2. It happened a bit in 4.16.1, but is pronounced in 2.

How do I rework the logic to account for ‘getting close’ to the limit and so I don’t surpass it? Sort of slow down as I get close to the aiming destination?

I was thinking of dividing the ‘factor’ of max degrees per second in half each time I get very close to the limit?
And also ensure I never surpass the max?

In the Elevate function, could we use the RelativeSpeed parameter to test if we’re getting close before we clamp that to -1/1 ?

Privacy & Terms