Walking/Jumping On A Moving Ship.

Hello, Im trying to create replicated movement on a moving airship/spaceship. Im having an issue where when the character jumps into the air the character flies away from the airship/spaceship. This has been done in multiple games like space engineers, star citizen, and sea of thieves. They are able to keep their character relative to the vehicle no matter while also having it replicated. For my game, I need to jump and move on this vehicle but somehow stay parented to it. I found multiple solutions online, such as: Moving the world around a static object, changing the camera location while on a static object, creating portals, and using the ninja movement plugin to attach to the floor, and even attaching the character manually to the boat. All of these will not work, increase jank or break the multiplayer experience. I believe the only way to fix this issue lies inside of c++ in the “set base” function, but Im very inexperienced in c++ and not sure how I would expose it to the blueprint. If anyone has any new ideas, tips, videos, or explanations I would be happy to hear them. But please keep in mind that I have tried all the solutions above (excluding setbase) with no success.

2 Likes

Your character will by default impart the velocity of whatever it is standing on, if your game has more arcadey controls for the spaceship chances are the character will be flung into the ether once he jumps.

The base should already be set on its own, try to log that from the getbase to see if it is correct.

I’ve attached a video link of a tick event of the current movement base, it seems like it makes the base “null” and sets it to nothing after the jump. Subsequently, when I fall back down I am reattached.

Tried changing the character velocity to match the boat but that didnt seem to do much.

Check if you have “impart velocity X/Y/Z” checked in the character movement component.

While in the air, naturally there is no base that the character is on.

the impart velocity turns to “0” when I jump in the air

The character no longer has any imparted velocity once he jumps, the whole idea is that if you jump on a moving platform you take the momentum it had at the time of jumping.

If the ship is accelerating while the character is in the air, then that would cause a delta between the character and the ship. But if the speed is constant, you should be jumping in place relative to the ship.

I’m not certain if you’ve heard of Galilean (pre-Einstein) relativity, but that’s what you’re trying to replicate. That should give you some ideas on what to google for.

In principle, yes, but in practice this is not at all how unreal currently works with the default move component.

If i make a platform and give it a steady forward speed and “Jump” the character will either translate forward or backward based on some magical physics voodoo that unreal has decided.

I’ve struggled with this exact same problem.

Then you add in “rotation” to the mix and its all over, as far as I can tell there is no reliable way to do this in blueprints.

You can try attaching the actor to the moving actor, but that causes it’s own problems ( the player will slide off of the platform while just standing there)

You can try removing the imparted velocity ( but that doesn’t work either because its doing some weird math behind the scenes)

I think he’s on the right path with essentially “locking” the base even while jumping, but there doesn’t seem to be a way to translate the charactermovement to work relative to the base while jumping without digging into the C++

I would LOVE to be wrong here though, cause this is an issue I’ve had for months.

He mentioned Sea of thieves which also has the exact behavior i’m looking to achieve, so it’s definitely possible to do, just not likely within blueprint.

If I jump in place on a platform which moves at a constant speed and the “impart base velocity” options in the character movement component are checked, the character will land where it stood as it jumped assuming the speed of the platform was constant.

If I jump in place and the platform has a constant acceleration, the jump will land slightly “behind” in the direction of the movement. There is a harsh “snap” once the character lands, but a wild guess is that it has to do with the camera “snapping” to a location momentarily.

Obviously if you still want to be able to jump in place on a platform that is changing its speed, you need to add those changes in velocity to the character as well while the jump is happening.

Sorry, friend but unfortunately that’s just not the case. It works sometimes, doesn’t work always.

I went ahead and made a video for you so that you can see it doing the exact thing you said it doesn’t do.

Here is an airship moving at a steady speed. the resolution is not great, but you can see the variable printing isn’t changing. That’s the “speed” of the airship. It is hardcapped at 1500 and doesn’t change. It is moving at a constant 1500.

I am just pressing " jump " i’m not adding any directional input.

As you can see, I am being thrown forward and backward.

again, if you know how to fix this I would love to hear it.

It did work, as I did it in the third person example project.

For whatever reason, at higher velocities, the character cannot brake fast enough as it lands back on the floor. The glitch that happens is a “slide”, it does not happen during the jump, but rather right as the character lands. Adjusting the braking friction factor helps, but doesn’t completely eliminate the issue.

Saving the character’s location in ship’s reference frame and setting that as the actor’s location in the OnLanded event would allow jumping in place without hitching, but that only works if the character doesn’t move.

I’d rather make a custom Jump function instead of using the one with the character movement component tbh.

Im not sure if youre willfully ignoring the evidence just to try and prove yourself right or genuinely arent paying attention.

You can CLEARLY see in the video that the character gains linear velocity immediately upon activation of the jump. There is also weird glitchiness on landing but thats a secondary issue. I suggest you watch it again, particularly the last several seconds where i am intentionally looking towards the ground so that you can very clearly see that the character is moving towards the front of the boat each time it jumps and this behavior happens at the launch event of the jump.

“Evidence”. I do not have your project, I only have mine, where I set a platform moving at 1500 * delta time right in one direction, and could only witness the glitchiness during landing. Not once did I experience any issues at the beginning of the jump. While I cannot prove a negative I also cannot replicate any of the issues you’re having at other stages of the jump.

Anyway, have a nice day.

Do you set or add impulse on jump (not override X/Y axis)?
Apologies if the question is too obvious, but didn’t see it mentioned.

That’s exactly what I’ve been saying. I don’t think it’s possible without digging into the CMC. I tell you what. The first person that makes this as a plugin on the marketplace is going to be VERY rich.

2 Likes

It’s pretty safe to assume CMC was created with games like UT in mind. Imparting velocity works - well, sort of, at slower speeds and scales, i.e not spaceships.

I got a bit more into it and well, solutions tend to range from keeping the player still to segmenting the ship into a stationary level and offering outside view through portals. Thing is, even if you implemented the movement in a traditional “the ship moves and the player moves relative to it” manner, you would want higher precision coordinate system at that point as well.

Definitely I’ve been digging into this for months. I’ve tried every solution under the sun that I’m able to do in blueprints and each iteration brings it’s own issues along with it. At this point I’ve come to releaize that if I want to do this right, I need to either learn C++ or hire someone who knows.

The most straightforward way I could see of doing it is to have a stationary ship somewhere in the world with everything that is inside the ship within it. Then, a proxy ship, which travels through the world, but nothing on that ship simulates physics or moves. The player camera is on the proxy ship, but the controlled pawn is on the static ship.

Now if player jumps on the static ship, the character on the proxy ship won’t jump like they would with a CMC, but rather they just update their location and animation to mirror that of the character on the stationary ship that is doing the real jumping. The character’s position relative to the ship in both locations remains the same.

While I could see this being doable in blueprints, if I were to ever build it I’d rather do it in C++.

4 Likes

I actually tried this too. It works well but replication is a nightmare in blueprint :frowning: