View Single Post
Old 11-05-2017, 12:20 PM   #105
GoldenCrest Games
High School Varsity
 
Join Date: Jul 2016
Thumbs up

Just killed the most epic bug EVER!!!!

I was holding off on playing Ex2.5 games to finally squash a bug that's been in the engine since day 1. It comes and goes, but it's always bothered me. Basically, once or twice a game, a pass would all of a sudden warp in mid-air and end up being an incompletion for no reason. Even if your guy was wide open, the ball would suddenly warp to a position (usually backwards) but keep its trajectory and miss the WR.

It only happened a few times a game at most, but sometimes you'd go 2 or 3 games without seeing it. It was infuriating.

I spent more than 10 hours tracking this single bug over the last 2 days, and I finally got it.

The problem was this:
  • I have the QB as the parent of the ball object until a receiver/defender catches it. It's the same way I manage the ball on kicks/punts, too. (Problem has never shown up there)
  • When another player catches the ball, it switches its parent to the player.
  • The bug happens only when the ball is in flight, before the parent is switching. It's triggered when a defender's collider overlaps with the QB's collider, while the ball is in the air. (Note: Colliders aren't supposed to overlap at all. They are supposed to bounce off eachother. Sometimes they briefly overlap if the physics system doesn't keep up with the movement, though)

It won't happen any other time, but it happens 100% of the time in this very specific situation.

My best guess is that the collider conflict causes a problem with the ball's positioning, because the ball is still parented to the QB when it happens. (and is being controlled by physics at the moment) If I parent the ball to the game at the moment the QB throws the ball, the overlap problem disappears!

That's pretty satisfying.
__________________
Live Chat!
YouTube Channel
GoldenCrest Games is offline   Reply With Quote