[ad_1]
I’m attempting to make a sniper intention prediction for an Unreal Engine 4 recreation. I’ve discovered this fascinating query Projectile Aim Prediction with Acceleration, and I attempted to implement in C++ what DMGregory stated. The outcome I bought is not dangerous in any respect, however I’ve some doubts about one thing in his clarification.
First, what does he imply with v_T? Should I calculate it as
FVector v_T = targetVelocity - myVelocity;
or as
FVector v_T = targetVelocity - myPosition;?
The vectors myVelocity and myPosition are respectively the rate and the place of the shooter (me).
Then, I seen that the sniper projectile trajectory does not appear to be an ideal parabola, so I averted the v_p calculation, and I’ve merely calculated the anticipated goal place as
FVector predictedTargetPosition = targetPosition + targetVelocity * deltaTime + goalAcceleration * deltaTime * deltaTime * .5f;
the place the three vectors targetPosition, targetVelocity and goalAcceleration are relative to the sport world axis.
After that, I merely added to the Z part of the predictedTargetPosition the next quantity:
recalculatedTargetPosition.Z += fabs(bulletAcceleration.Z) * deltaTime * deltaTime * .5f;
in an effort to compensate the lack of peak of the projectile in time.
What do you consider it?
Thanks upfront.
[ad_2]