Launch character to a target location

Hello,

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?
TIA

I’ve got this after some frantic clicking:

Image from Gyazo

Do tell if it looks OK, as in, worth exploring and I’ll clean in up and post in an hour or two.

Image from Gyazo

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:

Image from Gyazo

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:

2 Likes

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?

The project is attached.

Thanks!

So I am trying to reverse engineer this system for a project, because I have something similar in mind but I’m stuck. My actor is not moving on the spline, and I’m almost certain the problem is that the spline is attached to the character (when I spawn another actor on the coordinates and tell him to move along my original actor spline it works perfectly. The problem is probably quite trivial but I don’t know how to solve it.

Recording 2023-07-11 at 01.05.23

Looks like the spline comp is not set to be in absolute world space coords after spawning.

1 Like

Yes, that was the problem! Thanks

1 Like