I am working on a golf project and have hit a wall. I have an ‘out of bounds’ area marked and after three seconds, the player respawns. That is built and working.
The functionality I can’t seem to figure out is marking the last place a shot was taken. I don’t want the player to go back to the main starting spawn. Instead, I want them to teleport back to the last “good location”.
I have the Shoot action set to the Space Bar. My thought is, when the button is pressed, mark that spot as a transform and set that variable.
Then once the timer is reached for being out, a function is called and respawning the player is the last step. I have the spawn transform set to the location that should be pulling on "Space Bar Pressed’ but so far it’s only going back to the main spawn.
Thanks in advance for any assistance. I hope i was clear enough. If not, please let me know.
it’s a pretty basic system. Spawns the actor and uses the Posses function to ‘attach’ the controller. This also works. I am able to fire again after respawn.
I’ve also been printing the ball location to screen and I can’t get it to update in real time. Something I am doing is not correct. I’m getting coordinates, but they are the same no matter where the ball is.
I am not using any of those level events. I have things on BeginPlay, but that just sets a variable for Par amount.
I do have an AnyDamage event in my pawn blueprint that destroys the actor and sends it to the ‘last shot location’ (in theory). That’s triggered by the bounds area. After three seconds, the player is his with damage, thus triggering the AnyDamage event. I tried to account for the extra actors already, but I do TRULY appreciate the insight.
(This is the rest of the event from the screenshot above. It’s ugly as I’m mid-test, my apologies.)
The actor is a custom blueprint. The three components are a sphere, a spring arm, and a camera. Ball rolls, cameras sticks to it.
As the newest update: I was able to get it working. I could not get the transform to update on the pawn, regardless of location. I tried tracking the sphere component directly and got progress.
I am using that event to destroy the original actor/pawn. I have a UI widget that informs them they are out of bounds. That stays on screen permanently if I don’t destroy the original actor. The printed coordinates also show double values. This was the reasoning behind making it go away. As of yet, I have not had issues with the respawn player event not working. That being said, if there’s a better way to do it, I’m happy to try.
As far as not respawning the player, would you just suggest using “Set Actor World Location” after the delay and use the ‘Last Shot Location’ transform variable?
I apologize for my inexperience, I just kind of jumped in and started. I’d be lying if I said I have a real handle on any of. The logic part is easy to me, it’s the creating of the flow that eludes me.
Again, I appreciate all of your time and guidance.
I have the out of bounds area running a delay and then spawning the player at the last good location. I am having a problem with forward rolling after the teleport back. the player move carries over the velocity and the ball remains rolling. The lazy answer is to increase the delay amount and allow time for the ball to stop. It seems like a more reliable solution to find out how to stop the momentum once it’s moved.
I’m sorry to lean on you for something I’m sure is simple, but would you mind point me in the right direction? Thanks in advance.
*I will mark your answer as correct. I just don’t want to lose the commenting ability on this post yet. I will make sure you get your deserved credit though.
I can’t quite tell how your system is working at the moment, but things that might be useful:
You can know if the ball is still travelling with
( got that = node with )
So, it’s up to you. You can wait until the ball stops moving and the reposition. Or you can immediately reposition and just stop the ball
( I’m guessing ). Or perhaps
and then turn it on again, after moving it.
As for catching the out-of-bounds stuff, you could have collision volumes around the course. When they get triggered, the just send a message to the ball and player. Or, you could have a collision volume around the course, and when the ball stops moving, it checks if it’s still inside it.