Announcement

Collapse
No announcement yet.

How would I prevent a player from falling when teleporting to an unloaded level via the persistent l

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    How would I prevent a player from falling when teleporting to an unloaded level via the persistent l

    Hey everyone!
    I have a world with World Composition and origin rebasing enabled, and I would like to be able to teleport my player from one place to another within this world. I have created a PlayerStart-derived class which I can find and teleport to in the persistent level via my Gamemode, and so far everything is good.

    The problem is that when I do teleport to this PlayerStart, the level that the PlayerStart is closest to (i.e, placed as if it were inside it, only it's in the persistent level) doesn't load before the player gets there and promptly falls through the world.

    I've tried to solve it by creating a C++ function that disabled physics, checks if the player is on solid ground and then enables physics again. Unfortunately, neither disabling physics nor my ground checking is working. I either get an infinite loop, or nothing useful happens.

    I have considered just assigning the level the start is "in", for lack of a better word, however, this is an open world game and as such it'll be a world tile and not like a series of rooms - I believe it'll get tedious to link a level to the playerstart every time I want to place one. I'm also not sure if I can do it if it's a world composition level. Is there a way to get the closest world comp level?

    In PIE, UE obviously has some sort of solution for this already, since it is not an issue if I use the default player starts. However, I've been unable to find this anywhere.
    Any help in solving this would be greatly appreciated!
    Talk to me on qTox: E8FF4A2B55C2C3A8BC7B60F729E8884BF95CEB4FE8906AE76F5941B08E73066AF562A26C280B
    Stalk me on the IRC: jarl or jargon
    Need a launcher for your games? Check out Launchpad

    #2
    Well, the solution to your issue would depend on how the teleportation system works.

    If you're doing some kind of spell, where the user presses a button and teleports, then give that "spell" a casting timer, with a length of 5-10 seconds, and at the beginning of the spellcast, tell it to start loading the appropriate level. (Think World of Warcraft's Hearthstone item.) If, however you have a physical location in the map for the teleporter, place a good sized trigger zone all around the teleporter that loads the level before they get to it.

    If you want the teleportation to be instant, then you basically have 2 options; 1) always have the teleportation destination zone loaded, or 2) add a short loading screen.

    Comment


      #3
      The system is intended for two things - a graveyard-style respawning system, and racial start positions. I've tried adding a loading screen (which worked!), but I still fell through the world, as the teleport occured before the level had loaded in. As such, the teleport can occur from any point in the map - it could be close by, far away, or halfway across the world.

      The levels load based on distance, and I have no idea where to start if I want to preload a level, get a reference to it and wait until it's been loaded.
      Talk to me on qTox: E8FF4A2B55C2C3A8BC7B60F729E8884BF95CEB4FE8906AE76F5941B08E73066AF562A26C280B
      Stalk me on the IRC: jarl or jargon
      Need a launcher for your games? Check out Launchpad

      Comment


        #4
        Originally posted by Jargon View Post
        The system is intended for two things - a graveyard-style respawning system, and racial start positions. I've tried adding a loading screen (which worked!), but I still fell through the world, as the teleport occured before the level had loaded in. As such, the teleport can occur from any point in the map - it could be close by, far away, or halfway across the world.

        The levels load based on distance, and I have no idea where to start if I want to preload a level, get a reference to it and wait until it's been loaded.
        I get the same problem. No idea, how i can preload the level in composite world setup. Load streaming level dont work in composite world.

        Comment


          #5
          How I originally handled this, was to determine which level the player was teleporting to, my world was grid based, so based on the player coordinates, i could determine what cell they were in and then I added a callback on that level for when it was loaded. So I could keep a load screen up until then and have the player set to flying and player controls disabled.
          NVIDIA GameWorks merged branch (v4.9.2) (v4.12.5) (v4.13 p2)
          Feel free to Donate if you wish to support me

          Comment


            #6
            If I remember correctly I prevented the character from falling through loading terrain via "yourcharacter"->GetCharacterMovement()->Activate(false) to disable movement and of course true to enable it again.

            Comment


              #7
              Resurrecting this thread to post my personal solution to teleporting within world composition in blueprint. First, I get the name of the level that I will be teleporting to, then, I set disableDistanceStreaming to true, I UNLOAD that level, I then call setLevelLODIndex to 0,then loadStreamLevel. Once this function returns, you can teleport your player using whatever method you wish, making sure to re-enable distance streaming on that particular streaming level AFTER you teleport. The hardest part of this is getting the level name that you will be teleporting to, if you can do that, this works fantastically.

              Comment

              Working...
              X