Closed TackerTacker closed 6 months ago
Sorry, I don't know how to fix this. I didn't come up with the predictive aim maths myself, and I don't really know why it would produce weird results like that. It already reverts to basic aim if there is no solution and this project shows that happening, but it seems in extreme cases just before it gets to "no solution" it ends up with "wrong solution". If you can figure out the correct maths or checks to avoid this case perhaps it could be implemented, but otherwise I would say either use basic aim or design the project to avoid this happening.
Hmmm that's too bad, I appreciate you looking into it anyways.
I asked R0j0hound for help and he found a solution. He created a working example using events. I think he figured out that there are 2 possible solutions to the problem and currently the Turret Behavior basically picks the wrong one, or maybe doesn't account for 2 solutions? Idk, I don't understand the math, R0j0hound would have to explain it.
Anyways, here is the example project turret_behavior_aim_bug_and_event_based_solution2.zip
R0j0hound made another version in which he added a 2nd solution he thinks is closer to the original formula of the Turret behavior. turret_behavior_aim_bug_and_event_based_solution3.zip
He says his 2nd version is very similar to the 3rd solution described in this article "Strategy # 3 - Assuming Zero Acceleration" https://www.gamedeveloper.com/programming/predictive-aim-mathematics-for-ai-targeting#close-modal
Problem description
The predictive aim in the Turret behavior seems to have a bug.
https://github.com/Scirra/Construct-bugs/assets/18266300/57871f98-e732-4513-b885-a8ba8e4215bd
In the video (or running the project) it looks like there are 3 phases
My guess for the 3rd phase is that there is no actual solution at the speed of the bullets and player, so the equation just results in weird angles. I wish it would fail more gracefully, maybe reverting back to just pointing straight at the player without predictive aiming, but the 2nd phase is actually what really feels like a bug to me. Feels like it's off by 180°
( As a side note, I wish the aim angle would be available without the need to actually turn the object itself. Similar to how the Sine behavior has a "Value only" output option [ But I know that's not a bug ] )
Attach a .c3p
turret_auto_aim_bug_01.zip
Steps to reproduce
Observed result
The Turret Behavior is not able to predict the shot reliably, even if the player is moving at a constant speed and the turret rotation speed is high enough to be instantaneous.
Expected result
The Turret Behavior should predict shots more reliable and maybe fail more gracefully in case a shot is impossible.
More details
Affected browsers/platforms:
First affected release:
System details
View details
PASTE HERE