How to fix transform/velocity issue when possessing a moving pawn?

I’m having an issue while possessing a pawn that is in motion. In my level, there is a large elevator platform actor that is moving up. I’ve attached a turret pawn to it that the player can possess and swivel around as they shoot at targets. The turret is attached to the elevator on event begin play within the level BP and the player character attaches to the turret right before they possess it.

So my issue is that when the elevator is in motion and I go to possess the turret, both the turret and the attached player character “jump” upwards. When I go to repossess the player character (unpossess the turret), just the player will “jump” upwards. [You can see issue here: Possess Moving Character Issue UE4 - YouTube][1]

Playing with delays and print strings, I can confirm that the jump happens at the point of the Possess node in the blueprint.

I believe that the distance that the elevator has moved is somehow playing into this because if the elevator is not moving then there is no issue at all, everything works perfectly. If the elevator is moving, the player will launch upwards even further if they’ve possessed the turret for a longer period of time. The player will launch upwards only a little if I quickly unpossess after initially possessing the turret. Another note is that the first time that the player possesses the turret, even when in motion, the turret will not jump. It will jump every instance afterwards though. The first time the player unpossesses the turret and every time after, the player will jump.

I’ve done quite a bit of digging online and haven’t found anything that really addresses my situation or is similar. I’ve tried toggling on and off collision at different times and in different places, as well as adding padding to prevent collision, but that hasn’t fixed the “jump” and has presented other issues.

You say that the turret is a Pawn, does it have a movement component?

I wonder if it’s a case of movement components accumulating values but unable to deal with it since they’re attached. I’d try to play with one or both of these:

For the pawns that have a movement component. Probably just before the Possess happens.

Try unchecking the Impart Base Velocity properties in the Character Movement: Jumping/Falling section.

I’m sorry, its actually a character and it does have a movement component.

Thanks for taking the time to reply. I agree with your line of thinking that it seems to be some accumulation of the elevator, turret and character changing position. The elevator is just updating its location via a timeline. The turret is attached to the elevator. The player character becomes attached to the turret. I don’t understand why possession would impact their location? I’ve played with the stop movement and setting velocity but there was no noticeable difference… I’ll keep at it though. Any other thoughts? Anything else I can share from my blueprints that might give you a better idea of how things are setup? Thanks again!

One more question - the input is the player controller? Or is it implemented in each of the characters separately?

The elevator is just updating its
location via a timeline.

By Adding World Offset or Setting Actor Location?

The elevator is in motion by using a timeline to update the “Set World Location” of the elevator BP, simply using the timeline value to lerp between two vector points.
The Turret BP and Side Scroller Character use the same player controller.

Awesome, thanks, I’ll try to replicate it to see what’s going on. Will report back even when I fail :wink:

Ha, thanks! Really appreciate it.

Meanwhile, could you test this in the Player Character:

This should catapult you really high (I know, it’s the opposite of what’s indented). Essentially, characters are not allowed to stand on each other and since the turret is a character as well… Perhaps this kicks in.

edit: Probably unrelated the more I think about it.

Hmm, nothing seemed to change with that from what I can tell. I do have both the elevator and the platform “can character step up on” set to true.

Hey thanks for the suggestion, although that unfortunately didn’t work for me. One other observation is that when the turret/player jolt upwards, its instantaneous. They seem to teleport in one frame X units above their desired location and then they fall to their resting space; they don’t actually shoot up with velocity. This makes me feel like its a World Location issue where they are accumulating or inheriting values that I don’t intend… Anyway, thanks for the suggestion!

Turns out it’s pretty easy to replicate (although not sure why the turret goes all bonkers in OPs video) - perhaps because it’s a character, too?

My simplified setup:

  • a pawn turret attached to a moving actor
  • no collision on the turret whatsoever (to avoid potential issues / jumping off)

To me it seems that the movement component of the character stores its last position just before the attachment. The moment you detach, the delta between the last & current position is applied.

I made a fast moving elevator that goes up and down.

  • if I attach at the bottom, ride up and down, and the detach at the bottom - it works fine, since there’s no offset between the locations
  • the same if I attach at the apex, ride down and up again, detach at the apex - it’s solid
  • now, if I attach at the bottom and try to detach at the top - I shoot up roughly by how much I moved
  • same for attaching at the top and riding down then detaching - I end up under the moving platform

And no snapping to location, setting world location and collision or unpossessing seems to affect it.

Try unchecking the Impart Base
Velocity properties in the Character
Movement: Jumping/Falling section.

Tried that too, initially - no impact. Although I admit that this sounds like it really should work here

I’ll play with disabling the movement component next - I feel the way it updates is the culprit.

Hey thanks for the effort on this!
Yes, the turret is also a character, sorry I didn’t mention that earlier. Collision is enabled because it otherwise falls through the surface of the elevator once I repossess the player character.
I’m getting the exact same behaviors you list above… Like I shared with Grim, I feel that because the jolt/jump in location is instantaneous and the only velocity values that I’m seeing from the player character/turret are negative numbers (my elevator only goes up, not down) that the character is instantly repositioned and then falls back to the surface of the object below it. I even tried putting a ceiling above the character to see if I could prevent them from soaring into the sky and that didn’t stop them.

  • I’ll just that add that disabling the movement component does not work
  • neither does constraining movement to a plain (I mean it works but we still shoot off)

I’ve looked at what the component is doing under the hood and I got confused pretty quickly. Ha.

Will come back to this tomorrow. Perhaps something will come to mind. :expressionless:

This exercise does not spark as much joy as I thought it would.

Haha, tell me about it. I’ve been at it for a few nights and just can’t make any progress. I’m well out of my depth now. Thanks again for your time!

Yeah, the issue seems to be happening during the Possession of a moving character… I tried updating the World Offset and the Relative Location of the elevator platform instead of World Location to see if different values would give me a different result. No luck.

I also tried a very quick and dirty impelementation in the level Blueprint of the third person template and I cannot reproduce the behaviour.

ThirdPersonCharacter2 is just an idle pawn that I misused as turret. The character snaps to the “turret” and detaches as smoothly as I would expect, no matter how fast the platform moves.

right, somehow missed the possession part. When I do that I get the teleport as well. The controller does no transforms on the pawn so I am fairly certain it’s a bug in the character movement component.