I’ve been thinking about portal based space division and rendering recently (nice collumn over at flipcode.com if anyone is wondering what I mean by portals) but while most of it makes sense and sounds like a good system, I’ve become stuck on an important point: moving objects.
Static level geometry is ok, lets assume that we’ve nicely carved up our world into convex sectors and portals storing their connectivity. Portals join two sectors via a plane/portal geometry. Theres nothing to stop T junctions between three sectors though, and these are likely to be pretty common.
So where do we insert our dynamic objects? If its totally within a sector then it’ll be stored in an ArrayList or similar expandable data structure, but what to do when it overlaps two sectors? Store in a list in the portal? But then what to do if the object overlaps a T junction of three or more sectors (and therefore more than one sector).
Ideally I’d like to avoid storing multiple references to the same object, since this makes it easier in many areas (mainly for removing/adding when the object moves).
Anyone any ideas?