Training Stream - Tanks vs. Zombies, p.3 - May 17th

Hi ,

First of all, thank you for doing this stream series. You and Lauren have done a fantastic job explaining Unreal’s C++ API.

A couple of things I’ve noticed:

In your ATank::Tick method, in the part that handles the tank’s rotation there is a small problem.
[FONT=Courier New]

			if (AdjustedDeltaYaw < -90.0f)
			{
				AdjustedDeltaYaw += 180.0f;
				bReverse = true;
			}
			
			else if (AdjustedDeltaYaw > 90.0f)
			{
				AdjustedDeltaYaw -= 180.0f;
				bReverse = true;
			}

Float point precision errors make these comparisons fragile. For example, when the AdjustedDeltaYaw is 90, but the float representation is slightly off (90.0000001) the tank will move in the opposite direction. We need tolerance bounds to solve the issue.

To fix the issue with TankBP not spawning at PlayerStart, I had to change the “Spawn Collision Handling Method” of TankBP to “Try To Adjust Location, But Always Spawn”. But I couldn’t figure out what I was colliding with. Do you know what is happening?