So i have created using the UE4 documentation, a respawning system that on a pressed key, kills the actor and then respawns it.
This works fantastic, but i have run into a problem with the re spawn location.
The “level” is moving contently, so i wanted to have the option to re spawn to it if one falls off the mesh. But even if you attach the spawn location to the moving object, it fails to re spawn you to this ever changing position.
Was wondering if there is something that can be done to fix this?
Link of tutorial i followed
Images of my blueprint
from the sound of it you have a platform that moves around the level and you want to spawn the character on the platform. if thats the case then you need to set the spawn location to be where the platform is just prior to spawning the character. the easiest method to do this is to have a spawn point actor which moves along with the platform, then when you call the spawn actor of class node use that actors location as the spawn location.
example of how this could be done:
ok so first you will need to go into your gamemode and create a variable of type actor. then for the spawn actor nodes transform, get the variable then use a get actor location node then connect that to the spawn actor transform. then add the actor that will represent the spawn location into your level. next go into your level blueprint and get a reference to your spawn location actor. now create a script which goes like this: event begin play, cast to game mode, set spawn actor variable and connect the reference (like what you have in the character atm).
the basic idea in this example is the setting a actor as the spawn location. this way even if it moves we have a reference to the ever changing location. also i used the level bp here to set the actor variable but that could be done from anywhere or you could have a way to identify where to spawn via script.
Thanks a bunch!
The modifications worked perfectly as you showed it!
For future reference for people, in the level blueprint section. Just add a empty actor in your level, attach it to the desired moving object and then drag the actor into the level blueprint. This will properly reference the actor and then attach it to the SET section and boom you can always spawn to that point.
Thanks again and hope this helps future developers