I am trying to make a game where the player is on a moving ship and the ship can rotate in all directions, keeping gravity for the player on the floor. I found the Set Gravity Direction node on the character movement component helpful as I feed the ships up vector and the player does generally stick to the floors surface as I apply various rotations on the ship. However the control rotation is causing majors issues at least I believe it’s the control rotation. As the ship has pitchs and rolls I find the controller starts freaking out and the players p/y/r doesn’t seem to account for the new gravity and so the whole system breaks down. The camera freaks out, the player shakes around. But the bones of what I want are there.
I found that orient to movement generally solves this but now I can’t control my fps char the way I want.
From what I can tell the only solution is using C++ to make a change to the controller class that makes the update control rotation work with ever changing gravity directions.
Can smarter minds tell me if I’m on the right track or not? I have download VS but suddenly found 200+ errors and I think I’ve messed up my install somewhere. I’d just like to know if I should keep pressing on with VS and C++ before I continue.
That looks interesting thanks for replying! but im not sure it would work in my case where the floor can orient all the way upside down. Also I wanna have a wheel the player can walk all the way around too. Like a centrifuge. The issue is the update control rotation fighting me and this is not revealed to blueprints.
The annoying part is im trying to get c++ and visual studio working on my PC so I can try override the control rotation but something is very wrong on my system and I can’t get it up and running yet
Here is a video of my issue. When the ground (ship) rolls the player sticks to it thanks to the Set Gravity node but they start shaking (I’m not touching the camera until 00:17) and the camera generally starts freaking out and moving on its on and the camera is impossible to use and the camera flips controls.
Yeah the control rotation issue with custom gravity is a real pain. Since it’s not exposed to Blueprints you pretty much have to go the C++ route to override it properly. Once you get Visual Studio sorted, look into overriding the GetControlRotation function in your custom PlayerController — that’s where you can decouple the control rotation from the default world-up assumption and make it relative to your custom gravity direction instead.
For the centrifuge-style wheel setup specifically, you’ll likely want to recalculate the control rotation based on the player’s current floor normal each tick. It’s a bit of work but once it clicks it works really cleanly for any gravity orientation including full 360 degree surfaces.
Thanks! Your reply has given me hope I’m thinking about this in the right way. I’m so excited to work on my game idea but the control rotation is such a headache I wanna solve first.
You mention using normals for the centrifuge. I have gotten the centrifuge working as well as the regular ship gravity by getting the position of the centre of the wheel and negating the gravity. So the player can walk about the wheel but as with the example video when they start rolling and pitching away from the worlds up/down the character starts freaking out.
Id like to ask if the behaviour im seeing currently (The player freaking out and shaking like mad when I have no hands on the controls) is consistent with the control rotation not liking the new gravity position?
And my VS problems are very bad now I can’t get it work. Powershell is seemingly borked out my computer so I can’t even start messing with the c++ code
Lastly is the code shown in this tutorial pretty much what Id need to see my gravity working perfectly with control rotation?
I must admit I don’t fully get the code. I’m blueprint brained now aha. I just wish I could mess with it in my machine to see how it works.