Author Topic: Overly Aggressive Overlap, probably Quad Tree related  (Read 914 times)

GustoGaiden

  • Member
  • **
  • Posts: 11
  • Karma: +0/-0
    • View Profile
    • AndyGusto's Portfolio Page
Hey folks.
I just started up a new project with the latest Flixel build (2.5 Master, 8989e50)

I have a bunch of "enemy" sprites on the stage, and a "tool" sprite that follows the Mouse, and deals damage to the enemy when they overlap.

The example is attached. Press and hold the "Up" arrow to spawn new enemy sprites. Move the mouse to move the Tool.

I am seeing some strangeness that seems to stem from the Quad Tree. As you can see in the example, the overlap between the tool sprite and the enemy sprite produces many false positives. This becomes very apparent if you spawn many enemies, and then slowly move the mouse. It looks like the Quad Tree is counting ANYTHING in a large zone as Overlapping, instead of going through those zones, and checking for a valid overlapping. The quad tree seems to be skipping the crucial last step of the process.

Has anyone seen this before? Am I using FlxG.Overlap incorrectly? Is this a known issue? I've never had a problem just shoving Sprites together before.

Example SWF is Here.

Project Source is Here.

Thanks!
« Last Edit: Mon, Aug 5, 2013 by GustoGaiden »

GustoGaiden

  • Member
  • **
  • Posts: 11
  • Karma: +0/-0
    • View Profile
    • AndyGusto's Portfolio Page
Re: Overly Aggressive Overlap, probably Quad Tree related
« Reply #1 on: Mon, Aug 5, 2013 »
graaaaaah. I figured it out. I was not calling super.update() on my main state's update loop. My entities were not updating their last x and y positions, and were permanently fixed at 0,0. The collision hulls in the quad tree were very large.