I’m making a train game, and I want the player to be able to walk around freely on the trains, while also able to take a seat. I was afraid of having to do something too complex to get smooth player movement on the train, but luckily Unreal has me covered for that (As long as the slopes are shallow which is fine).
But when the player sits down, I’m having an issue. My current solution is to spawn a new character and posess that so the player can look around in their seat without having full control. Unfortunately, when I do this, the character no longer inherits the rotation of the train, but instead keeps their previous rotation.
This is what the blueprint looks like, the SitDown function on the character simply handles things like disabling gravity, collision and motion.
I agree with @Quetzalcodename , instead of respawning the character, have a boolean switch like “bSitting” and only allow look movements and stand option whilst this value is true.
I’ve tried just stopping the character from moving, as well as spawning a new character. The behaviour seems to continue even if I use snap to target instead of keep relative.
Finally through further testing using a basic pawn would have the desired effect, as that would inherit the rotation from the parent
I’ve tried the simplest possible attachment of the character to the seat, and still no dice.
What I failed to show with the video is its not just the camera that is rotating, it is the entire character. I’ve attached an arrow to its base, and that remains pointing toward the camera.
I have not adjusted any of Epic’s character settings to my knowledge, just added the interact function for sitting down.
It feels like it should be a tickbox somewhere that I’m missing, but I have tried all the ones that seem to relate to rotation or controller, I’ve played with every value but the networking values as those don’t seem relevant at all.
I’ve even tried calling this on an unmodified FirstPersonCharacter, after a brief delay, I force them to sit down. The heirarchy believes they are attached to the chair and then the train, but their rotation simply isn’t inheriting. This should be reproduceable by simply parenting a character to a rotating object in somewhat clean project.
I can understand why, for a shooter game, if I’m in someone’s vehicle, maybe I don’t want my aim to fly around as they’re driving and swerving, but for this game I explicitely do want this behaviour as its a quiet train ride.