Getting non-normalized vector length in Blueprint for leading a target

Been using Blueprint, and love how fast it is for prototyping, but I’ve run into a case where I feel like I’m fighting it.
I’ve set up a stationary turret which needs to be able to lead its target. My thought is that I can calculate the aiming location with one of these:

  • Turret’s location, delta seconds, target’s non-normalized vector, projectile speed
  • Turret’s location, target’s normalized vector, target’s velocity

It looks like all vectors are normalized in Blueprint, and I can’t figure out how to bypass this to get the non-normalized vector’s length.
Velocity is returned from the target as 0,0,0.
I can add each target’s current forward speed to a blueprint interface, but this seems like a lot of unnecessary clutter on a public interface.

Is there a more obvious solution that I’m missing here?

What vectors are you encountering that are normalized?

#Character Movement

If you obtain the Character Movement component of your target, assuming its a Character, then you should be able to get the regular Vector Length of the Velocity of that component.

simply adding the velocity + the angle to the target will lead the target pretty much exactly.

#Angle to the target

Target->GetActorLocation() - Self->GetActorLocation()

then add the non-normalized velocity and you have turret target leading :slight_smile:

Have you tried that?

Rama

For a pawn, I can only use Get Forward/Right/Up Vector, which are all normalized to a length of 1. Everything else is a location or rotation.

It’s easy to get around this by writing the velocity to a variable and exposing it in an interface, but it’d be good to know if there’s something available without going through that step.

I’m using pawns for the targets (uncertain about the overhead on using hundreds of Characters rather than Pawns, so I’m avoiding that), but looks like this confirms that I should just store the velocity so I can access it from the outside.

Thanks!