x

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"

ThirdPerson fire Projectile, trace to sky

So I have been playing with the thirdperson template and added quite a few things. But there's one thing I couldn't figure out how to fix, which is Shooting Projectile while Aiming at the sky. I have recorded a short clip demonstrating the issue I am facing,

Watch it here:YouTube

Is there any workaround for this kind of situation? Please help!

And here are the blueprints that handles my projectile spawn: 1 2

Product Version: Not Selected
Tags:
more ▼

asked May 05 '15 at 04:44 AM in Blueprint Scripting

avatar image

juniortan
31 2 4 5

avatar image earthur Oct 10 '15 at 04:47 AM

Did you ever find a solution to this I am having the same issue and can't seem to get it figured out....there must be something causing it to redirect to location 0 0 0. Something I did as a semi work around was set a different spawn if the hit result bool is false so the projectile will just fire in the direction that the weapon socket is pointed in but that takes away some of the functionality that I wanted to achieve with the line trace.

avatar image juniortan Oct 10 '15 at 09:20 AM

This was 7 months ago, nobody tried to help so I kinda gave up on it and settled with spawning projectile forward when line trace return false.

But I just thought of a workaround while typing this reply. You can try to create a large invisible box the encapsulate the level and set the line trace distance to be long enough to reach it. Let me know if it works :)

avatar image earthur Oct 10 '15 at 01:19 PM

If the trace fails to hit an object within the accuracy range it will get the last reachable point of the trace (500000 unit out) and then get the X axis for the projectile to align with, this way objects that are very close still get hit in the center of crosshairs and further out it maintains most of the accuracy (full accuracy out to 500000 units slightly degrading after) everything after the "SpawnActor" node has to do with the sounds and emitters etc for the muzzle. If the trace hit is true it will point the X axis of the projectile towards center of crosshairs since the closer the object the closer the intersection of the 2 points becomes...at further distances the points are closer together......if the trace-end doesn't hit something for some reason the spawn will give it a X axis pointed toward world location 0 0 0 so this is the way I got around that.

I hope that makes sense, it also keeps everything within the projectile spawning functions short and simple with out adding giant actors to scene.

avatar image earthur Oct 10 '15 at 01:27 PM

I will post a video in just a few showing you the differences between first way and second

avatar image earthur Oct 10 '15 at 02:00 PM

Video Demo This video show the difference between using the branch and not using it, using it give us the extra spawnactor node that will get the X axis of the last reachable point of the trace to use in the spawn transform of the projectile if the line trace doesn't actually hit something. I hope it helps clarify what I am talking about. The way I am doing it works but I was looking for possibly better solutions, which is why I asked you what your solution was if any. Let me know if you need more info also if I find a better way of doing this I will make sure to post it here for you.

avatar image juniortan Oct 10 '15 at 03:12 PM

cool, move your post to answer so that i can mark it as an answer.

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

2 answers: sort voted first

This is how I ended up fixing the problem: alt text

alt text

more ▼

answered Oct 10 '15 at 09:30 AM

avatar image

earthur
1 3 2

avatar image juniortan Oct 10 '15 at 10:44 AM

What the logic behind it?

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

In your case you can use the location for the "End" pin of the trace for the last reachable point ("Max Accuracy Range" in my screen shot) and then use the "Projectile Spawn Z Offset" vector variable (the "Barrel Mesh - Socket location" from screen shot) Subtract the "End" pin for your "Z Offset" variable then from there a "Make Rot from X" node to the "Make Transform" node of the "False" pin SpawnActor and use the "End" pin location for the spawn actor transform location and that should fix it for you. Let me know if that works

more ▼

answered Oct 10 '15 at 02:10 PM

avatar image

earthur
1 3 2

(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