My game is divided into discrete “zones” separated by quick loading screens, but I’m having a little trouble ensuring that the correct doorways connect across levels: if I move from Building A to the overworld, I expect to start just outside Building A’s door. Right now I’m accomplishing this by giving each doorway a set of coordinates, teleporting the player to those coordinates when he uses the door, and trusting the level streaming volume to load the desired space around the character. That feels slightly hacky, as typos in one door’s coordinates would be hard to catch but instantly derail gameplay, but I can’t honestly think of an implementation that would require less hard-coding; is my established system an acceptable way to go about things, or am I missing an obvious alternative?
I mean, I’ve never done anything like this, but I’m thinking you could put a bunch of locators where you’d want the player to spawn and give the door a pointer to it, and teleport the player to the locator the door is associated with
Ispheria has the right idea. Just add a socket, scene component, collision volume, etc. to your door actor (one for each side maybe?). And then to.Mke sure you always spawn the player in the correct position relative to the door, just do so by referencing the correct door and getting the world location of the associated “locator” object.
The only potential pitfall i see is how getting the world coordinates interacts with level streaming, because the way i understand it, level streaming “re-zeroes” world space whenever another chunk gets streamed in.
Ooh, that’s a really good idea; I had initially dispensed with the idea of using an actor to target the teleport as being as much hardcoding as manual coordinates, but making it part of the door itself (and thus, something that would delete + GC itself when the level unloads) is a great idea. I just whipped together a super-crude test blueprint, and getting the world coordinates doesn’t seem like a problem, since I’m running GetWorldLocation for the scene component before I stream anything new in, so the actual move occurs before the coordinates get re-zeroed.
My only caution to anyone doing a similiar thing would be to make extra-sure that the coordinates you’re teleporting to don’t collide with anything- I was initially teleporting with a bunch of weird offsets to the intended coordinates, or plain not teleporting at all, and that seems to happen when centering the character at the destination coords causes his capsule to collide with something.