SuggestProjectileVelocity() Behaving Badly

Steps to reproduce…

  1. Checkout this commit
  2. Run the project, start the game, point the aim point at the ground
  3. Note the Output Log reports an aim solve every frame
  4. Comment line 40 in TankAimingComponet.h (and the trailing comma on line 39)
  5. Note that we now only get a solve every few frames, despite this being an optional parameter.

(This also happens in 4.12 but without the optional parameter, you get a correct response for a higher % of frames than in 4.11)

Hi BenTristem,

At first glance, I noticed that a different Enum value is being passed into SuggestProjectileVelocity() with the line in the .cpp file commented out. With the line left as it is, ESuggestProjVelocityTraceOption::DoNotTrace is passed in. If that is commented out so that the default value is used, ESuggestProjVelocityTraceOption::TraceFullPath is passed in. This results in a completely different set of code being run in the function. I’ll try to dig into this some more to find out why using the default value only seems to update when the mouse is being moved.

Hi , I’ve noted that if you make a minor movement movement of the mouse you will get it to alternate between succeeding the trace and failing it. i.e. it will be a series of “found”, then minor mouse movement anywhere, it will be a series of “not found”

You’re quite right , I meant to leave the TraceFullPath option, but the problem stands.

The default value is to trace as written previously.

I believe that the missed solutions come from that start point is inside the barrel and end is close/below floor (floating point rounding etc). If you raise end by a small amount, you will only miss when aiming at the ground below the tanks.


Hi Daniel,

I hadn’t considered the possibility of floating point error putting the target point slightly below ground level, but it appears that you are correct. That should have been something that I recognized, but I completely overlooked it, so that was a good catch on your part. I modified the code to move the target point up slightly and the function appeared to work fine using the default Enum value.

@BenTristem, could you try adjusting the vertical position of the target point slightly and see if that resolves the issue that you are having?