Quadtree test

Hello all I’ve been messing around with Quadtrees lately, and I have came across this guys implementation which has some sort of weird effect

I followed this tut

However please correct me if im wrong but the way Im using it makes entities not detect collision when moving from one node to another
Here is an image… of a sim I just made (All entities bounce of each other) You should see clearly what I mean

I made some changes to the code which fixes this issue but I find it rather odd why no one else has mentioned this… I feel like I have made a mistake somewhere

Here was my fix

	public void insert(Entity e){
		if(nodes[0] != null){
			List<Integer> indexes = getIndex(e.getGlobalPosition().x, e.getGlobalPosition().y, e.getWidth(), e.getHeight());
			
			if(indexes != null){
				for(Integer i : indexes)
					nodes[i].insert(e);
				
				return;
			}
		}
		
		// Fits in this quad
		objects.add(e);
		
		if(objects.size() > MAX_OBJECTS && level < MAX_LEVELS){
			if(nodes[0] == null){
				split();
			}
			
			for(int i = 0;i < objects.size();i++){
				Entity o = objects.get(i);
				List<Integer> indexes = getIndex(o.getGlobalPosition().x, o.getGlobalPosition().y, o.getWidth(), o.getHeight());
				if(indexes != null){
					for(Integer iq : indexes)
						nodes[iq].insert(o);
				}
			}
		}
	}

It basically uses the dimensions of the entity to see if it collides in any other node, then adds them all to an array for checking… the only issue with this is there is a higher chance of doing the collision check on the same entity twice, but its faster then checking every entity