Hiding one section of a level from another

So I realized that you would also need to sync the sun and any other lights that cast into the interior whenever the ship moves & rotates, as well as any objects outside the ship that cast shadows inside the ship (ex. another ship, rocks, or debris). I then realized that the ship also can cast shadows onto other objects outside the ship (can be seen at the beginning of the video). Taking this into account, it would be simple just to have the character in the ship, that way, everything works naturally. So I tested my idea.

Looks good so far. The only problem is the camera can be kinda janky sometimes, but the ship is small, so that may be it.

Notes:

  • The player’s pawn is still the character, and the ship is an actor with a skeletal mesh and camera, and the view target is set to the ship. The character and interior is under the level.
  • The ship has the character as a prerequisite tick actor (the character always ticks before the ship) so that the character’s transform & variables are up-to-date when the ship reads it.
  • The ship’s skeletal mesh has its own animation blueprint; it’s the exact same as the character blueprint, just that the “Get Owning Pawn” is replaced with “Get Player Character.” This is actually necessary because the character’s skeletal mesh animation stops updating when far away, so copying the pose can cause the ship’s skeletal mesh to stop animating.
  • The only things that are being copied are the character’s skeletal mesh transform, the camera’s transform, and any variables the animation blueprint needs (which is just velocity and “Is Falling”).

Haven’t tested this in multiplayer yet, but it’s a good start.


Edit: The interior can be hidden by setting “visible” to false or “hidden in game” to true; the character still simulates even when not visible. You can use collision channels to keep the interior and exterior physics from affecting each other. The interior should be put at (0,0,0) so that the character’s world space position is also its ship space position.

1 Like