Download

Space ship that moves but the player can still walk around

Hey Guys

I want to create a ship that when you go inside and lock the door the ship becomes separate from the inside so that a player can walk around inside the ship while its flying, but not be affected by the physics of the ship moving. I also want to do this within a bigger ship so the first ship could take off and fly out of the hanger. Would this be done with level streaming? I think looking out windows etc could be done with cameras and a “screen” in front of the window. Any help at all would be appreciated. I really don’t know how to tag this haha.

Thanks
Jason

Not sure if I understood your question correctly but it’s quite common trick to keep the ship stationary and move the environment around it (like clouds in the sky). This will make the illusion of movement when ship/character/whatever actually is stationary. Maybe separate the landing/takeoff into own level and when the player is taking a walk in the ship use level where the above trick is used and switch between levels when required.

You understood correctly, however this method wont work because there will be more than one ship flying at the same time… I had the idea of when you enter the ship your pawn is TPed to another level which is the ship interior. After that use cameras etc to create the illusion that your really in the ship. I am just unsure if its all possible…I guess another example of what I am imagining would be like the tardis…the inside would be a different level than the outside because its bigger inside. Does that make sense?

The other ships can very well move.

It’s just yours that has to be steady.

To make you understand, let’s say your ship is at the axis center and there are two ships following.

You can just move the background around the ship to give the illusion of the three ships moving together and then move the other two ships from the axis center to change their position compared to your ship.

I understand, but I want several ships to do this at the same time, so say 3 ships all with crew that can walk around inside them. This method is limited to 1 ship with a crew that can move.

So long as the object is marked as ‘Can be Base for Character’ - you can walk on it using the Character Movement Component and the Character will move with it. It’s called ‘based movement’

Even if it flips upside down or the actor jumps?

How to mark it?

If you want to do this so that the ship itself is moving, and not the world around it, you will need to have make your own gravity or basing solution.

By default the gravity in UE4 isn’t made to change direction, you’re either being pulled up or down on the Z axis. So you could add in directional gravity.

Another solution would be to change some of how walking around and basing works. A good first step for this might be to change how the game checks the slope of what your character is standing on, because that bit of code will un-base you automatically once the slope reaches a certain angle. With this you’d have to either disallow jumping or make a custom jumping solution for when you’re walking around in ships.

Also if it helps, the game “Angels Fall First” (The UDK version) handles walking around on moving ships is by having a separate area on the map for ship interiors which it teleports characters to. The rooms never move or rotate, and the windows that show action outside the ship are just render targets.

Have not tried it but should be easy enough to test.

For anything to work you have to begin with the context of of how objects needs to interact as a series of events and lets say the player is already on the ship.

You can make the ship a character BP and give it it’s own animation BP. A good starting point would be to make use of the flying template which already has everything set up.

You will have to do some editing like making the ship a room that the player is contained with in.as to typical behavior of the player walking around it as an environment space. Collision and stuff.

You could then try making the character a component of the ship so that it inherits the movement of the ship and add it’s own animation BP to walk around it. This could even be another character BP containing it’s own movement component.

A bit more complex than it might need to be but the ship can be controlled independent from the player and if replication is needed it’s all handled for you via the movement component.

But

A simpler way would be to link the character to the ship (flying room) so that it becomes a child of the ship but it’s transform becomes relative to the location of the ship as the parent and not the world. Things like gravity can then be changed independently between the ship and character but the characters position will be constrained by it’s parent.

As I said I have not tested the theory but the problem I’m seeing is based on an assumption that both the ship and the character have to be relative to world space where the characters position needs to be relative to the ship which is child of world space.

.

.