HeadsUp Issue unexpected "Jittery" effect

Hey, everyone, it has been some time, I,m having a issue with the Obj.HeadsUp, where some times it “jitters” now this wouldn’t be a issue normally, however in my game, the right vector is needs to be consistent for movement to be possible when the character is tilted at a 90 degree angle.

So What happens is when I put the character on a 90 degree angle surface, sometimes the character’s H flips between 180.0 to 0.0 back and forth, while it’s P flips between positive and negative 90.0, but it’s R stays the same at 0.0, I think some vector seems to be mirroring back and forth from what the HPR is revealing.

Does anyone know why this happens, at first I thought it was another feature of my game doing this, but constant tests seem to reveal it is only the headsup doing it, I would be grateful to anyone who is willing to help, thanks for your time.

I think this is due to gimbal lock. The solution may be to choose an “up” vector to pass as extra argument to the headsUp function. By default it is (0, 0, 1), and if the look-at vector is also (0, 0, 1), then Panda won’t know which side is up.

do you know how the syntax of that would look like? sorry, I,m using

self.obj.headsUp(self.obj, Point3(0, 1, 0), entry.getSurfaceNormal(self.render))

Do you have any idea how I would fit in another reference vector?

Edit: rdb, you were right when you said it is gimbal lock, so I did some research on the topic here in the forums for a couple of hours and found a thread about crossing vectors here

from tests, my character’s right and forward vectors were screwed over from the flipping, however the character’s up vector was still consistent, and I don’t use the character’s forward vector, I have a static one (Vec3(0, 0, -1)) in place for the movement system, all I need is the right.

So using my movement system’s already in place static forward vector and crossing it with my character’s up vector I created a useable right vector and I was able to repair my movement system at least. So while not elegant, it works, so I will mark your post as the solution.