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"

Best way to get distance between two objects

Hi there! Scenario: I have a lot of objects (all of the same type) that constantly require the distance to the player character. I'm using this this blueprint to get that distance as a float.

However, is there any other better way to do it? I fear that having a lot of actors performing this calculation each frame may affect performace, badly.


Product Version: UE 4.20
more ▼

asked Dec 13 '18 at 10:15 PM in Blueprint Scripting

avatar image

14 1 2 5

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

2 answers: sort voted first

There's a "Get Distance To" node that does exactly that alt text

dis.png (20.5 kB)
more ▼

answered Dec 13 '18 at 10:23 PM

avatar image

1.7k 11 6 8

avatar image Skycert Dec 13 '18 at 11:45 PM

Ok thanks! Didn´t saw that at first...

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

You can get distance between any 2 vectors (does not even need to be actor location) by subtracting them to each other and checking length of resulting vector

more ▼

answered Dec 13 '18 at 10:42 PM

avatar image

34.6k 917 164 1095

(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