I have a JQ dummy bot and I want her to be able to aim her knife and be able to compensate for the arc of the projectile as well. Any idea of how to go about that?

Are you trying to predict a potential targets position you want JQ to aim at and throw her knive or just want to visualize the arching projectiles path? Cause we would need to clarify some factors and cases regarding to ballistic problems depending on your goal.

The trajectory calculation of a 40 m/s object launched at roughly 2m (Junker Queen is 7 feet tall) would only require a 3.3 degree angle adjustment to reach the same position on a target at the maximum 60m knife range. I donâ€™t know if it would really be worth it. It would probably be easier to create a set rule that when Ability 1 is not on cooldown, to temporarily set your existing method for bot aim (ray cast(eye positionâ€¦ etc ) to the same position + World Vector (0, 0.2, 0) â€¦ about 7 inches higher

Well when you can obtain the constant gravity acceleration of the dagger first, you can calculate where to aim ahead in time, you would need to find the travel time when the target and the projectile (the dagger) intersect, if the OPâ€™s goal is to predict the targets position. The OP needs to clarify what he wants to do first.

Hi, if youâ€™re still looking for a solution for this check out these codes.

[QKQ8G] This one calculates the arc for a stationary target and is perfectly accurate. It also adjusts for the delta vector that some projectiles have.

~~[2G6XE] This one I made based off a code from a person named Yurrod (KJRR5P). His code only worked for a few heroes so I tried to generalize it. It calculates for the targetâ€™s velocity but the Y prediction becomes inaccurate at ranges >20m or so. The XZ portion is always accurate though.~~

Youâ€™ll want to copy over the rules â€śsolve_ballistic_arcâ€ť, â€śloop solve_ballistic_arcâ€ť, â€śset player facing impact point (aimbot)â€ť, â€śset projectile type (change here for different abilities)â€ť, and â€śset projectile speed - secondaryâ€ť

In â€śset projectile typeâ€ť youâ€™ll want to change eventPlayer.proj_type to the string â€śsecondaryâ€ť.

In â€śset projectile speed - secondaryâ€ť Thereâ€™s also a lot of extra data for other heroes that you can remove to save space if you just want JQ knife.

If you wanna get into the math of it, google â€śsolving ballistic trajectoriesâ€ť. There should be a blog post by a person named ForrestTheWoods. I tried to recreate his solver in my code at one point, but it ended up not working out.

Edit: Turns out I forgot to update my workshop code after attempting to solve for projectile gravity and delta vector. mb. The old code still has a solution for linear projectiles, but what I said about it solving for arcs was a lie. The code below actually attempts to solve for projectile arcs.

[9Z1VN0] Correctly calculates for the XZ position of a target with velocity. For linear projectiles Y is accurate always. For arcing projectiles the Y prediction becomes inaccurate at ranges >20m or so.

Youâ€™ll want to copy:

Subroutines: â€śset_curr_hero_indexâ€ť, â€śupdate_projectile_dataâ€ť, â€śset_proj_facingâ€ť, â€ścalc_proj_leadâ€ť, and â€ścalc_arc_proj_leadâ€ť

Rules: â€śInitialize: Static Global Variablesâ€ť, â€śSet player projectile dataâ€ť, and â€śCalculate Player Projectile Trajectoryâ€ť

In â€śSet player projectile dataâ€ť, thereâ€™s a player variable called proj_type. Itâ€™s basically an index for primary, secondary, ability 1,2, and 3 since the projectile data is stored in an array. In the demo itâ€™s set to primary and never touched again, but you can set it dynamically just before firing the ability you want to aimbot. If you do that just update proj_type, call â€śset_proj_facingâ€ť to update the projectile data, and wait a few ticks for the aimbot target to update before pressing your ability button.

Also in the demo all the subroutines are only called once so you can squash them into the rules theyâ€™re called.

Saw your work around it, and know the blog post few months ago and was referring to that here with â€śthe time of travelâ€ť due of it was unclear what the OP actually wants to do, appreciate your impact very much .

There is also a GDC video on youtube where ballistic problems are a topic, i canâ€™t post a direct url in here unfortunate but can format it in here:

`[Math for Game Programmers: Predictable Projectiles - YouTube](https://www.youtube.com/watch?v=6OkhjWUIUf0)`

When you do a google search youâ€™ll also find that somewhere at the first page, i guess you already saw it. The speakerâ€™s name is Chris Stark, he references also some code for his case on github if i remember.

And about the topic alone here, there was a question made about linear projectile problem, also a few months ago, and was answered by Teawy and Jalier somewhat here:

Maybe you want to have a look and give your insights there as well.

And that thread was a reason to look into ballistics further again. Stumbled around, and found some informations like the blog and GDC video, used CAS on CoCalc, Symbolab and Wolffram Alpha with AI support. And all say about arching projectiles even the AI (ofc) and the original author of the problem which the blog post is derived from, how hard it is to solve it due if you form the equation it turns out to be a quartic and may return not real roots, and to work around it using some approximations that feeds on real time processing and that is very expansive, looking at the situation how loops are handled in workshop.

Thats why i am also glad Overwatch seems not to consider in the factors of air force drag, surface and volumetric friction and density. Imagine we would need that too .

There is also a GDC video on youtube where ballistic problems are a topic

Hey thanks! I have not seen that video before but I wish I had, I learned a ton. Like you mentioned itâ€™s really hard to get a perfect solution. The one in the updated code I shared eventually turned out to be good enough for my use case, so I gave up on finding a perfect solution.

Iâ€™m also glad OW physics isnâ€™t too complex. Some projectiles get additional height at launch, and figuring out how to account for that was already pretty annoying.

No problem, iâ€™m glad i could help with the video. Yes the delta vector is a really unpleasant factor to deal with, but they implementate it to accomedate i belive for some weapons that have like Soldierâ€™s or Sorjournâ€™s Rifle recoil for the sake of immersion, one example is Junkratâ€™s Frag Launcher. Or case of varying projectile speeds, looking at Hanzoâ€™s charging of Storm Bow Arrows, i attempted to create a mapping table of charge and their corresponding speed value and triage it together with a possible max distance, to tell a Hanzo bot at what distance should Hanzo charge to a respective value and fire at a speed so the arrow will hit a target at the predicted position. It turned out to be a creepy pasta code, and paused my attempt of creating a generalized Aimbot. Oh man, it still bugs me until today, and i am eagger to retry, but well the effort is huge and really questions the worth out of it .