I’m attempting to launch my currently controlled character to a location the player has clicked on. I’d like the character to launch in an arc from their position and then land on the target location. (Think Thor leaping with his hammer and doing an AOE at the end of the leap)
I’ve tried a number of methods from adding impulse to predicting projectile paths. The closest I got to was using the array of vectors from PredictProjectilePath and then using SetActorLocation from those - this seems to work ok if you turn off Gravity. Unfortunately this leads to a very stuttery experience - as the actor is doing micro jumps from one location to the next - was hoping for something smoother.
I was hoping there was someone out there that has solved this, or something like it?
I’ve got this after some frantic clicking:
Do tell if it looks OK, as in, worth exploring and I’ll clean in up and post in an hour or two.
Yes that looks very much like what I’d like to do! If you have some code / BP / explanations I would be very grateful
I’ve added a couple of bells & whistles, some much needed control, limiters to keep things in check and variables to parametrise it:
The general idea:
- we generate a spline between us and the click location with the mid point elevated
- we use a timeline to project a point along the spline over the timeline duration
- we adjust player velocity so it chases that point closely
In short, it’s a glorified rubberband that works surprisingly well.
- LMB: set landing location
- Mouse Scroll: adjust the apex of the set jump
- 1: Execute jump
I’ve added comments where I believe it made sense. Do tell if anything else makes little sense. Not attaching screenshots due to time constraints. Here’s a project link, though:
All script is in the character blueprint, the yellow bit:
More complex than I expected, but a perfect implementation - thanks a million.
can you upload a better quality image so i can read your nodes?