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"

Simple line trace weapon problem in BP

Hi All,

I have created a weapon blueprint using blueprint. The custom event i created work but the line trace fires in other direction then where i look. Here is an example and the blueprint i use. In the green circle you can see it fires to the right, when i turn 180 degrees it fires left. alt text

I use this BP alt text

I dont know what im diong wrong.

If someone can help me that would be great

Jack

Product Version: Not Selected
Tags:
linetrace1.png (1.4 MB)
linetrace2.png (123.5 kB)
more ▼

asked Mar 03 '15 at 07:39 PM in Blueprint Scripting

avatar image

Eowalin
1 1 2 1

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

1 answer: sort voted first

Ah :D

Easy mistake to make. Don't multiply the vector. Add it. You have the location of your weapon socket. You calculated the trace (forward 5000 units) but now you have to add it to extend it on top of the location. Multiply will multiply each value in this vector (which exists of 3 floats) by the one of the other vector.

So yea. Just search for + and you should be fine ;)

Cheers

more ▼

answered Mar 03 '15 at 08:02 PM

avatar image

Erasio
6k 291 86 293

avatar image Eowalin Mar 03 '15 at 09:53 PM

Thanks for answering man, really nice of you :)

Can you please give me an example, cause im a real noob if it comes to mathmatics and unreal.

If you could do that you will make my day.

avatar image Erasio Mar 03 '15 at 10:13 PM

There's honestly not a lot to it.

Just replace the multiplication node ( x ) after the multiplication with the float and the forward vector with an addition one.

Like this:

alt text

You can do that by simply pulling out a wire from the vector pin and searching for "+".

Cheers.

linetrace.png (142.9 kB)
avatar image Eowalin Mar 04 '15 at 06:26 PM

Thanks for the comments dude

Here is my setup of thw blueprint again. I did what you said but im still firing sideways.alt text

Here is the blueprintalt text

I really dont know whats happening anymore :S

linetrace4.png (1.5 MB)
linetrace3.png (199.1 kB)
avatar image Erasio Mar 04 '15 at 06:40 PM

Well this already looks better.

Now have you checked what "Forward Vector" provides you with in the rifle BP?

Maybe get the owning character and use it's forward vector for testing?

avatar image Eowalin Mar 04 '15 at 07:25 PM

Hi there, Thanks again, I copied the bp components to my character and now it fires the correct direction! But the only problem that i fires the right direction im looking but not up of down.

Bp incoming: alt text

linetrace5.png (121.3 kB)
avatar image Erasio Mar 04 '15 at 08:30 PM

Well that's due to the way you use the "Get Forward Vector". This provides you with the forward vector of your actor (character in this case). It doesn't change with where you look. You can get the camera and use it's forward vector to always have the exact middle of the screen. It will shoot slightly below where you're looking (by the amount of units your gun is actually below your camera) but in the right direction.

(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