How can I output one vector variable from one blueprint to another?

I’ve got one blueprint that sets a vector point, then another blueprint that sets another vector point. I want to work out the distance between these two vector points but I can’t seem to get the blueprints to communicate this information?

I’ve been looking up how to make them public and seen the “Direct Blueprint Communications” wiki page, but I can’t seem to get it working with a vector. Is there something obvious I’m missing? I’m sure this should be easier than I’m finding it…

this is to compare the distance between two projectiles when they’ve hit a target, so they aren’t always spawned in the world which i think may be complicating things.

Have you tried using a blueprint interface?

Yes, but I’m not very familiar with them so i may be missing something. I think the problem is as they are spawned in (Projectiles) I can’t as easily reference them as they aren’t in the game. I’m not certain what to do about this.

I’m not entirely sure I understand, but if this is supposed to compare two projectiles both hitting the same target, couldn’t you do the following?

  1. use an array to keep track of all projectiles’ hit position
  2. when a projectile hits, check if it’s the first one (array length == 0)
  3. if yes, shove its hit position into an array
  4. if not, grab the previous projectile’s hit position and do your distance check

If you’re trying to compare projectiles hitting different actors, you’ll have to store the first projectile’s position somewhere easily accessed globally (PlayerController, maybe).

I’d wanted a projectile that hits a target, then fires off another projectile, which when that hits, it compares the distance between them. However, I realised I could get the same effect using rays, in the character blueprint, so I don’t actually need to do this now.

The issue I had been trying to do was communicate between two blueprints (projectiles), that spawned in, rather than being persistent and I guess I was having trouble sending variables between them as like you say, they can’t always be accessed globally.