Projectile Not Inheriting Momentum?

Good morning everyone,

Maybe this isn’t the right place for running down my CV. Short version is, I played with UDK and didn’t accomplish much, and now I’m back with a vengeance to finish a game in Unreal Engine 4.

The concept is thus: You have a target in front of you moving left and right. You can move left and right… you wanna keep pace with the target. You can tap anywhere in the screen to fire a projectile at that location (using GetMouseLocation to trace to a hit point on an invisible hitbox behind the foreground scenery. This hitbox occupies the entire screenspace.) Unfortunately, I don’t have the blueprints in front of me, but I’ll provide them asap. The setup is simple.

Left right is accomplished by AddImpulse (I believe, to accelerate) or something along those lines, taken from examples the 6DOF flying UFO. The projectile is a simple OnClick, with GetMouseLocation determining the start and end points. This works fine when stationary but becomes worthless when moving. So I tried adding AddImpulse (or SetLinearPhysicsVelocity, can’t remember which I settled on at the moment) using the PlayerController’s current X velocity (the left/right movement) as the variable that gets injected.

At low speeds it works decently well. For example, you fire at pixel (4,10), whether the pawn changes velocity or not I want the projectile to inherit that and interpolate that movement (I’ve considered using interp but I believe that wouldn’t work) so that it will hit pixel (4,10). I want the hit result to always match the point on the screen that was tapped. As the speed of the pawn increases, the projectile becomes less reliable, until at about halfway to my desired top speed, it no longer functions at all. I can tell the projectile is inheriting some sort of momentum, but I can’t figure out how to work it when the speeds go much higher, and I also can’t figure out how to keep it updating.

I’m considering putting them on a spline to determine their movement and just having the spline be attached to the two moving points on the spawn and the target mesh. This is not ideal for later, as I want to add arcing to the projectiles, and would like to have the length of the hold determine the strength/speed of the shot (which may increase or decrease the arc required.)

So, I think the simplest way, without then having to learn to edit splines in real-time as well as having my hitplane follow the player, would be to correct this momentum issue.

I appreciate anyone’s help. I will be posting the blueprint when I arrive home at 8am. Thanks again to the whole community. Obligatory good guy disclaimer: I’m totally okay with not getting an answer because this engine is really amazing, well documented, and though I’ve hit a roadblock, eventually I’ll surmount it because I’ve learned with this technology you just gotta want it bad enough; anything is possible. So keep on keeping on. Also, please help me lmao