I’m a very, very novice programmer, who just wrapped up a Udemy course on C++ with Unreal. Despite that, I’m finding the Blueprints more and more easy to use, so I guess that’s that.
Anyway, I decided to go without too much direct instruction for a while and try my hand at implementing something of my own. For my first effort I settled on making a very, very rough mechanic of a movement system from this book series, Mistborn. Basically, my goals are:
- Make it so the character can throw a coin in whatever direction they’re looking (done!)
- Make it so the character can press a separate key and be flung in the opposite direction of the last coin they threw.
I found out that there’s a Launch Character function, which is superb, but getting the launch velocity for it is proving tricky. In my mind, the best way to get this would be to get the Vector from the most recently thrown coin to the ThirdPersonController, then use that to get a Velocity and then fling the player. But I just can’t seem to find a good way to get the location of the last coin thrown. I’d use a cast and then GetActorLocation, but I’m struggling to find a way to plug an “Other” object into the cast. The InputAction event doesn’t have that object node to plug into a cast, I don’t fully understand why that is, and I’m a bit stuck on how to progress.
So, TL;DR: how can I get the location of an object in the world on an input event to get a Vector to launch the player?
(bonus question, I’m not sure how I would specify it to only grab the location of the most recently spawned coin, so if anyone has any advice in that department please let me know thanks)