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"

Linetrace to the center of the screen totally off

Hi guys. Im trying to make a linetrace from the muzzle of the weapon to the center of the screen, but i cant get it to work. I mean, yeah it kinda goes to the center of the screen if i shot from far far away, the problem is the offset is totally wrong when shooting near objects. I also tried to using the camera location instead of the socket location to set the end point, with the same result. Any ideas what could be wrong? heres two screenshots. Thanks in advance. alt text alt text

Product Version: UE 4.16
Tags:
clipboard02.jpg (324.9 kB)
clipboard01.jpg (519.0 kB)
more ▼

asked Oct 28 '17 at 05:03 PM in Blueprint Scripting

avatar image

amstradcpcuser
31 3 9 13

(comments are locked)
10|2000 characters needed characters left

3 answers: sort voted first

it depends where you are going to shoot to. I would imagine it is a ground there the center of the screen is. For that you need:

1) make a line trace from the camera location to camera location + direction * 5000 to get intersection with the surface (Hit results -> location)

2) Now you are good to do a line trace from you muzzle to that intersection point from 1).

more ▼

answered Oct 29 '17 at 04:02 AM

avatar image

Flash7
829 9 16 27

(comments are locked)
10|2000 characters needed characters left

Yes. i ended doing it that way. But i wonder if there isnt a simpler method to do it. And why isnt working as it should with the setup i had.

more ▼

answered Oct 29 '17 at 04:47 PM

avatar image

amstradcpcuser
31 3 9 13

avatar image Flash7 Oct 29 '17 at 05:16 PM

This is the correct method of doing it as you need to specify an exact point where to shoot to. What you did is you traced from muzzle to muzzle + 5000*direction of the camera. But since your muzzle is not at the center of the screen you get that offset that you see on your first screenshot.

avatar image Flash7 Oct 29 '17 at 05:18 PM

if your problem is solved, can you please mark it as answered? :)

(comments are locked)
10|2000 characters needed characters left

I dont understand. The end point is muzzle location + forward vector of the camera. It should be pointing to the center of the screen. Anyways, not going to keep my mind busy more time with it lol. Btw, i dont have a clue how to make the post answered.

more ▼

answered Oct 30 '17 at 05:44 PM

avatar image

amstradcpcuser
31 3 9 13

avatar image Flash7 Oct 30 '17 at 06:41 PM

"It should be pointing to the center of the screen"

it is hard for you too see because you are too close to the center (but not quite there). Place you muzzle to extreme, like a side of your screen. Then add a forward vector of your camera to the muzzle. It will never point to the center of the screen.

(comments are locked)
10|2000 characters needed characters left
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