Now this is all very nice as it allows me to show off the detailed models and other eye candy, but it does present one problem ... many of the units have turrets that track a target (in 3 dimensions as most of the units are aircraft). This works fine when the target is just selected or some distance away as the turret rotates round until the target is in its sights. However, once this point is reached the turrets have a tendency to twitch or judder. Basically even at high check rates the point being targeted changes every update and the turret adjusts to the new target position. If the target is changing position rapidly then the turret starts tracking again but if the target position is relatively small then the twitching starts and can be very noticeable (there is a certain amount of twitching when units are targeting other units but this is most noticeable for turrets probably because they can be orientated out of parallel with the direction of movement meaning that changes in the relative target position are more frequent).
So far I have done two basic things that should help,
- Movement is proportional to the frame rate to avoid uneven movement (and this works fine with normal turret rotation)
- When close to being on target the turret will rotate only what is needed and not the total rotation possible in the time since the last update (there shouldn't be any rotation overshooting and need to adjust back ... although I am currently rechecking the code once again).
- Acceleration and deceleration on the turret movement so as it starts moving again the adjustments are smaller than when in full rotation ... however I have a feeling this will still result in visible twitching
- Using a firing cone - while the target is still in this cone the turret does not move (as it is effectively still on target). It would reduce the small twitches but would this result in less frequent but larger adjustments (slower bigger twitches)?
- Delayed movement after firing so they turret does not move for a certain time and then checks if adjustments are needed. I suspect this is similar to using a firing cone (the target is assumed to still be on target)