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"

Distance to object?

Hello,

I need to create a blueprint that constantly scans for the location of a static mesh relative to the player. I'm creating a sound system in Max MSP that communicates with UE4 and to change the parameters in real time in max I need to be sending the distance through OSC. Does anybody have any idea how I can get trace the location of the object relative to the player?

Product Version: UE 4.8
Tags:
more ▼

asked Sep 09 '15 at 06:58 PM in Blueprint Scripting

avatar image

Joem1991
41 3 4 9

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

3 answers: sort voted first

Hello Joem1991,

If you would like to find the distance as it would be expressed in a float you could use the example provided below. I hope this helps.

Example:

All that is needed to get the distance is to subtract the vectors as mentioned by Nsomnia and to get this value as a float you will need to then get the vector length.

alt text

Make it a great day

more ▼

answered Sep 09 '15 at 08:34 PM

avatar image

Rudy Q ♦♦ STAFF
47.4k 545 132 524

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

Ramas victory plugin has a GetDistance to and a node that can translate the cm/s to any speed you want.

Otherwise the stock getDisantceToActor or something ActorToActor

Otherwise you can GetWorldLocation(actor) and GetPlayerCharacter -> CastTo(yourcharacternamebp) and then drag off the blue pin and GetWorldLocation

Then just compare the differences between the locations. It will be in cm reletive to the root component of your actor but you could re-root something to be the root or pick out an individual component with some work.

Hope this helps Don't forget to accept an answer that best clears your question up or answers it so when the community finds your question in the future via search/google they know exactly what you did to fix it/get it going.

more ▼

answered Sep 09 '15 at 07:44 PM

avatar image

Nsomnia
1.8k 67 27 137

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

You're a hero, I'll give it a go and see what happens!

more ▼

answered Sep 09 '15 at 08:21 PM

avatar image

Joem1991
41 3 4 9

(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