Calculating Projectile Velocity for Parabolic Arc

Didn’t see your edit previously.

Are you working in 2D only (X and Z)? I’d assumed so from the way you set Y to 0 in your first post, but the way you set dir.Z to 0 then take Size suggests maybe you’re in 3D?

Just to confirm, I believe your Gravity variable should be +9.8, not -9.8. And you should check that term isn’t negative before passing to Sqrt (if it is, it means no solution, though that shouldn’t happen for sensible inputs in this case).

Finally, what are the trig functions you’re using? C-runtime? In the code you pasted you’ve passed in the angle in degrees, nearly all trig functions expect input in radians (= degrees * PI / 180).