Character controller doesn't inherit rotation from parented objects?


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.

Hi there @Sandshee, hope you’re well!

This topic has been moved from International to Programming & Scripting: Blueprint.

When posting, please review the categories to ensure your topic is posted in the most relevant space.

Thanks and happy developing! :slight_smile:

Hey @Sandshee!

A couple of questions:

  • What a happens when you change your rotation rule from keep relative to keep world or snap to target?
  • Instead of spawning a new character, why not add a variable or use the disable movement mode?

Any additional specifics you provide may go a long way in solving your problem!

1 Like

hi @Sandshee

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.

1 Like

Hi @High500 and @Quetzalcodename,

Thanks for the replies.

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.

image

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.

Thanks again for helping

Ok so let me understand you correctly. When you sit down the actor doesnt face the correct way, and doesnt follow the trains rotation?

Are you attaching them correctly? Character as target and chair as parent? And the chair is parented to the train right?

Did you ever figure this out? I’m having the same issue.