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?

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.

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

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.

Make it a great day