Line Tracing to target and arcing projectile path


So, I’m in a little pitch here. I want to make my projectile travel in an arc from my character to the target hit by line trace. I’ve been doing all grenade tutorials and timelines I could find but nothing seems to be working for what I actually need which is something like this:

The closest I got to my goal is lerping the values of X and Y like (0 at 0, 0.5 at 0.5, 1 at 1) and lerping the values of Z
like (0 at 0, 1 at 0.5, 0 at 1). My blueprint
Part 1:

Part 2:

Sorry if my blueprints are a little bit of a mess the the moment

I’m a little bit lost because the animation starts playing only after projectile hits the target or it starts way above my character and then slowly descends to the desired location. Projectile also seems to be following my cursor which is not the intended behaviour. To give a better idea of what I’m attempting here is a youtube video:

All help is more than appreciated, thank you! :slight_smile:

Bumping, still hard stuck :confused:

I recommend watching this video by Mathew Wadstein. Also, look into Suggest Projectile Velocity blueprint node.

You may want to add Projectile Movement Component and use it’s Homing functionality to guarantee missile hit on your target.

Let me know if you run into any problems.

your methodology seems to be pretty solid from what i can tell. i just made a similar system which takes into account a difference in height which is posted below. the one i made works like what your looking for but i would have guessed that yours would work as well given the timeline curves are set right. for the method i employed i used two curves a 0-1-0 and a 0-2. since i wanted to take into account the height difference between the player and the enemy i had to lerp between 3 values so thats where the second curve came in paired with a select node. other than that its similar to what you have. do keep in mind though that the start and end points (the actor locations in this case) should be set to static values to prevent odd behavior such as exponential acceleration. also check to see if within your projectiles blueprint the hierarchy is affecting things, such as not having the wrong component set as root. depending on what the root is all sorts of odd behavior can occur.

as for your projectile following the cursor that should be a separate issue thats not part of whats shown here.

Thank you, I’ll be sure to take a look! :slight_smile:

Yes! That worked wonders, thank you very much! I see now that my problem was wrong curving, for experimental purposes I added your curves to my code and it worked as well. I’ll spend a lot of time studying this since this is some insane math right here. Also, thank you for heads up in height differences, my original blueprint doesn’t take that into account at all. Cheers!

I know I’m asking a lot but after studying your code I came up with a question. So if I’d like to retarget this blueprint to Arc between the values of XZ and YZ, kind of like 45degree angle to each side, retargeting this blueprint and switching values with XY istead of Z should work, right?

creating a system where it arcs in any direction other than z is considerably harder. im sure there are many ways to actually do it though, its just more complex. off hand i would think that you would need to either work in local space instead of world space or you would need to work with the players right vector. otherwise your into the realm of figuring out the math.

another way it could be done though is within the projectile itself. have the projectile move forward at a constant rate then have it deviate slightly to the right or left and have how far it deviates based on how far from the target it is. but again its a bit complex

Yeah, I quickly bumped in to the issues you described. Switching X or Y instead of Z makes projectile rather frantic and almost impossible to work with, I’ll try working in local space then I guess. I might just share the solution when and if I figure it out. Anyways, thanks a ton for your help!