Download

Attaching Player to Moving Object Permanently

Hello Everyone

I’m wondering if someone can help me with this problem. It might seem simple but I haven’t been able to solve it.
I want to attach a player to a moving platform through blueprint permanently.

I currently use the attach to actor node but it snaps to the actor once. And then the player can start moving again.
Could always lock the movement buttons but even with this I want the player attached in place
so even when the platform tilts the player doesn’t slide off.

I guess just picture the player unable to move like a bear trap but can still look around as well.

Any help would be much appreciated.

Thank you in advance.

you could copy the object’s location and set it to the player’s

Haven’t done this in UE4 yet, but maybe I can give you some ideas and get you started.
Overall imagine there’s probably lots of ways to parent actors in UE4 to make this work.
In UDK to get this working reliably using sloped platform etc you had to disable physics.
So get a reference to your Pawn and connect it into an UnTicked Simulate-Physics node.
By the way, what’s your Attach-To-Actor -> ‘Location-Rule’ set to at the moment as well?

You could try setting movement mode to none

cezieu

Through blueprint? And would I be able to add a offset to this as well or would it have me clipping the object?

My Rule is set to snap to target.
I dont believe there is Simulate Physics mode but I might be wrong.

Would this stop the player from falling off the platform as well or just stop from taking movement commands.
I would still want to be able to look around as well though mind you.

I’m not entirely sure if a character supports being parented to another object by default, the way I do it is to just turn off the player’s physics/gravity and set location/rotation to be where the vehicle is in my case. If you wanted a “bear trap,” as you first posted, just add an If Bool where the players movement controls are so If Bool InSnare is True do nothing, or manually set the movement components max walk speed to be 0, effectively making the player an immovable slug.

Yes cryzo through blueprint. Just communicate the object’s location to the player for example with casting and then add the offset you want by adding it to the location vector, and then set the player’s location. On event tick.

Is it possible I can get an example? I have been trying that but still doesnt get it to stick to the object. Rather just a one time teleport to object.

Thank you for the suggestion Deathstick but still the player would fall if the platform tilted.
As in when I play with the gravity I am not really immovable. Just unable to move until the platform twists enough for me to drift off.
While it does disable the player moving it is only half the battle :frowning:

Agree with Deathstick, mentioned this already etc… So did you actually disable physics?

Physics disabled usually means no gravity, which means no response to sloped platform.

Granted that’s from UDK, not verified in UE4, but intuition says it probably still applies…

… Plus unticking ‘Enable Gravity’ on the Pawn…

I use disable gravity as well as playing with the world settings as well. The minute the platform goes to fast and leans too much My character just drifts off with no attachment to the platform.
As well as when I disable physics, the character doesnt even move on the platform. Just stays completely still from the spawn point. While yes the character is technically not moving, the character as well wont let the platform move him either.
Im just thinking I want it similar to a looped roller coaster effect where the character wouldnt fall off when doing the loop.

Interesting, 2 other suggestions and must try this out myself with more time:
BTW: How is the platform moving: BP interp / physics/ matinee / timeline etc?

  1. Check if with Physics off, the mesh of the Pawn is still ‘Movable’…
  2. Substitute Pawn by spawning Pawn static mesh set to ‘Movable’…
    Toggle visibility of Pawn off, now how about the attached camera…
    Add second spring arm / camera? Bit strange that this isn’t easier…

Are you setting the actor location of your player to be the actorlocation of the platform, or a vector offset from the actor location of the platform? As that is what will cause your player to move with the platform. If its in a function called once/not in tick it’ll only update the players position that frame and never again. Bonus points is you can remember the player location before enabling the platform to move while the player is on it, and use that to offset the position relative to the platforms location so it appears seemless/“no teleporting.”

You MUST update the players position to be whatever position you require in event tick, I recommend just setting it to the actorlocation of the platform until you get that working, then add the above mentioned vector offset for additional polish.

Another thought! Maybe combine this:

With Disabling all Pawn movement…

Thank you so much everyone. I finally was able to do it.

Thanks franktech. The post really helped with it.

No worries good luck dude!

Hey, would you be able to explain how you were able to do it? I’m running into a similar problem with a fast moving platform.