Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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: alt text

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: alt text Part 2: alt text 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: https://www.youtube.com/watch?time_continue=4&v=0HqHgjtNw4Q

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

Product Version: UE 4.19
blueprint.png (153.5 kB)
blueprint1.png (151.5 kB)
blueprint2.png (164.4 kB)
more ▼

asked Apr 03 '18 at 01:18 PM in Blueprint Scripting

avatar image

3 1 2 3

avatar image Cystematic Apr 04 '18 at 10:53 AM

Bumping, still hard stuck :/

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

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.

alt text

alt text

capture.png (303.1 kB)
capture2.png (64.4 kB)
more ▼

answered Apr 04 '18 at 03:24 PM

avatar image

10.1k 33 10 25

avatar image Cystematic Apr 04 '18 at 04:24 PM

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!

avatar image Cystematic Apr 04 '18 at 05:15 PM

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?

avatar image ThompsonN13 Apr 05 '18 at 12:11 AM

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

avatar image Cystematic Apr 05 '18 at 09:45 AM

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!

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

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.

more ▼

answered Apr 04 '18 at 02:12 PM

avatar image

161 1 6 5

avatar image Cystematic Apr 04 '18 at 04:21 PM

Thank you, I'll be sure to take a look! :)

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question