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"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

UMG Socket Lines

Hello, I am trying to create a slot based attachment system for my weapons and i need to visualise what attachment goes into each slot.I need a way to draw a line from the weapon socket to the desired slot without making the slots world widgets. ex: Sight Socket line going to the center of the Sight Slot.

Product Version: UE 4.21
more ▼

asked Feb 24 '19 at 01:15 PM in Using UE4

avatar image

7 2 2 3

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

1 answer: sort voted first

What are world widgets? Do you mean widget components?

  • create sockets on the weapon mesh

  • create widgets for the attachment

  • have a full screen widget with just a canvas and use it for painting lines

  • add the attachment widgets to the viewport or to the above-mentioned canvas

  • use canvas' onPaint to draw lines from the attachment widget (as Canvas Slot or use Viewport Position) to the deprojected socket location on the weapon mesh

more ▼

answered Feb 24 '19 at 06:58 PM

avatar image

14.6k 76 25 61

avatar image Rypz Feb 24 '19 at 11:31 PM

Thank you for you answer,but I realised that I asked the wrong question,the onPaint function seems to be the solution,but I couldn't get it to work in my case,because I am using a Render Target to capture the weapon and then render it to UMG.I don't suppose there is a solution to get the lines directly from there and I can't paint them manually because I need to be able to rotate them with the weapon.alt textalt text

capture.png (220.6 kB)
capture1.png (128.5 kB)
avatar image Everynone Feb 25 '19 at 07:43 AM

The image helps.

I think it's still doable but the render target will make it more difficult since you're now dealing with a bunch of pixels rather than actual world coordinates.

Since you have it all set up nicely already, consider the following:

  • add the sockets to the mesh as mentioned above

  • translate their location into 2d screen coords using Map to Range node

  • use the mapped coordinate as the line end

Now that I can see precisely what you're attempting and how it's set up, there are several problems with this:

  • it's unlikely to be pixel perfect and may be jiggly and slightly inaccurate

  • you will most likely need a separate set of offsets for each weapon

  • the lines will cross if you rotate the object (unless you have only 1 at a time)

  • the above will require you to sort the slots in the panel at the bottom (a bit tricky but doable)

  • since you're using a container for slots, you can't get their position directly - you'll need additional calculations to get the positions of the slots locally (it can be simplified by painting on this very widget only); I imagine you do not want the lines to ever leave this space anyhow.

This all sounds pretty complicated. UMG is not geared towards this. Not using render targets makes it easy, though.

avatar image Rypz Feb 26 '19 at 12:43 PM

Thank you for all the help, It should be enough to get it working either way, this was very helpful.

(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