Vector Math - How to add Current Player velocity and add it to Projectile?

Math time!

I’m trying to add projectile velocity inheritance to my shots. Basically, the faster I go, the faster my shot goes. Right now if I my current velocity exceeds the muzzle velocity I run into the projectile and it explodes.

The problem I’m running into is the fact you can only Set Velocity in Local Space shown here. X is always forward in the case of Local Space. I need somehow take my character movement velocity and rotate it to whatever direction I am facing, then add 4000(Base projectile velocity)? My brain is toast on this one

Your math is kind of wrong.
I think you just need add both vectors: 4000 times forward vector and current velocity.

So make 3d vector out of that x,y,z of “character movement”
Get forward vector of player pawn (or camera if its fps game, or anything that points to right direction), Normalize it (just to be totally sure its 1 length) multiply this vector by 4000.
Then add both vectors.
Line trace work wonders for debugging vectors. If above does not work do trace line for velocity and forward vectors.

In case you really want what you describbed:
To rotate vector you need to make rotation/ Best for you is “make rot from ZX (or XZ)”,
This will create rotator. Then you can rotate unit vector around axis (up or Z for you)
Or just use “rotate vector” and whole rotator.
I never played with characters yet, so i am not sure which axis is what for them.

Ps.
Also Cross product will always give you 3rd vector that is normal to 2 given vectors. This way if you have left and forward you can find up. and so on.
Also dot product gives cosinus between 2 vectors. So with acos and some fiddling with sign you could find angle in degrees.

Hey Nawrot,

I actually achieved my goal “somewhat” by using Character Movement Velocity + Get Actor Rotation into Unrotate vector. Unrotate vector localized my velocity so that X/-X was Forward/Backwards and Y/-Y was Left/Right, I set this new vector up as a variable called Inheritance. Then it was simply Inheritance + 4000 on X Vector which I sent to Velocity in Local Space.

The results are quite humerous. Due to the nature of inheritance, if my backwards velocity exceeds 4000 I can actually hang shots in the air. I’m fiddling with base velocity which is why it says 3000. My character should never be moving that fast backwards, I still need to adjust character movement