cockpit camera orientation probs

Blitz3D Forums/Blitz3D Programming/cockpit camera orientation probs

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

I've been meaning to fix the cockpit cam in SRX for ages, but it's really annoying me now because I just put the loop back in.

Basically the camera is not parented but is positioned at the car's position, then rotated using DELTAPITCH and DELTAYAW to match the vehicle's orientation, but over a few frames to soften the effect and avoid too much juddering.

The problem is that when the vehicle goes around the loop the camera reverses direction by 180 degrees and then pitches around violently to match the new orientation, I assume caused when PITCH crosses the -180 to 180 boundary.

Has anyone got a system of camera tracking and orientation that will allow a camera to correctly and smoothly orient with and follow an entity that can invert and flip by 360 degrees, but is not just rigidly parented to the target?