I’m a beginner and I can’t do this: choose a “Player Start”. I see a lot of similar questions in the forums and on YouTube but for multiplayer. What I’m interested in is for the solo game.
I explain what I would like:
I have an outdoor map in which you can enter certain buildings. To enter a building I load the corresponding map via the “Open Level” node. So far, so good.
The problem is in the opposite direction. When exiting the building, and therefore loading the outside map, I’d like the player to be positioned in front of the entrance to the building he just exited. For this I have placed a “PlayerStart” in front of each building entrance, but I don’t know how to do it.
To summarize, if the player exits building A, the “PlayerStart A” must be applied, and if he exits building B, the “PlayerStart B” must be applied.
Can someone more experienced please help me?
Thank you very much.
Use a Target Point Actor in the outside map where the door of the building would be. Add a tag to the target point to identify it (BuildingA_Exit). Use Get All Actors of Class with Tag (BuildingA_Exit). Get the location transform and use it to spawn the player. Do the same for Building B…(BuildingB_Exit). You can use the same approach for entries…BuildingA_Entry, BuildingB_Entry.
If your buildings only have one entrance, an easy and performant method would be to store the player’s location in a variable every time a door is entered, offset backwards a little bit by the door’s forward vector so it is out of the loading zone. Then when leaving, set the player’s position to this location.
Thank you very much for these answers. In both cases I hadn’t thought of that. I was thinking too much about “PlayerStart”… Rookie mistake. Thank you for these answers.
So should the Target Point replace the PlayerStart?
In this context yes.
In the Game mode you can overwrite the player start function.