Download

Prevent roll change when turning upside down

Hi there,

I have a little game set up where you control a small bullet racer through a raceway. The bullet itself is a pawn with a FloatingPawnMovement controller. You strafe with the mouse, both jaw and pitch. The thing is, I was trying to make it so that I could get past the vertical pitch limit (turning the player upside down when they strafe all the way up) since I plan on making maps with no sense of verticality whatsoever. In order to achieve this, I created a CameraManager blueprint class and modified its pitch limits. It did its work, but when upside down, the jaw controls were inverted (moving your mouse to the left would get you strafing right). I performed some research and I found the root of this: when upside down, the roll was automatically set to ~180º, thus inverting the jaw controls.

Is there any way I can fix this? I’ll attach my bullet blueprint here just in case it’s helpful:

Thanks!

Greetings @rubeneles !

Welcome to the Unreal Engine Community! :medal_sports: We see that this is your first time posting in our forums!

Although I personally will not pretend to know exactly what is happening in this case, I do want to let you know that we deeply appreciate you posting your question here. Until someone with a higher level of expertise responds, I do want you to know that you are a part of an awesome community, and we’re very excited to have you as a member! Happy Creating and Good Luck on your project! :smiley:

PawnControls

Not sure exactly of your implementation, but you could try messing with the settings in Pawn under your Class Defaults of your blueprint. Maybe setting a custom rotator variable and get it and connect it to SetActorRotation node could maybe get you something you’re looking for…

@Humanasset I messed around with the settings in your screenshot, and all I could achieve was bugged, erratic movement sadly

Sorry, that didn’t work for you. It seems the engine is trying to correct your rotation by automatically rotating that -180 degrees like you said. Probably because the world has its fixed axis and I don’t think you can change that. I could be wrong… I’m just throwing this out there trying to help. I haven’t actually implemented this in your specific case, but I’ll post a screenshot of what I think might help…

I know that you can easily invert your controls by multiplying your axis value by -1 which would effectively invert the controls and you might not have to fight to get your racer’s pawn to actually change its axis once inverted. I just GetActorRotation and split the struct pin. You could do this for each axis and set it up similarly to pitch and such…

You may have to get your camera’s rotation and not specifically the actor, because I’m not sure what you have set up, but you should be able to just invert the controls when your rotation exceeds the vertical limits you have set up.

You may also have to specify through another branch out of the true that if the value is <= perhaps -200 or what not so that is only inverts within that range and not just stay inverted if you are able to rotate all the way around… If that makes sense. You could even invert the controls at a lesser value, but I’m not sure how funky that might end up. lol

Again, just throwing this out there, hopefully it helps!

@Humanasset woah, this worked like a charm. Although I may have to adjust the -100 vaule since there is a certain point in the pitch axis where I can’t strafe in the jaw axis. Either way, thanks a lot!

1 Like

Excellent glad I could help! I had that float value at -180 but the screen shot looks like -100. The -180 should get your controls inverted straight up and down. I haven’t had a solve yet if you want to mark this resolved lol.

Oh well, that makes sense lol. Its not a perfect solution since the zenithal angle doesn’t allow for jaw strafe but it’ll do the work for now. I’ll let this open in case anyone has another solution.