I'm under the impression that the current system does a prim for prim collision check without any optimization. This could be optimized with a few layers of 'object data' saved for objects. I'll use a car for example.
When a user links a object (regardless of phys status) that object needs to get flagged for 'optimization processing'. In the first stage a SINGLE bounding shape should be computed that most snuggly encompases the entire linked object. The only 2 shapes really optimal to use for this are boxes and spheres. This optimization could allow for HIGHLY effecient processing to eliminate collisions between nearby objects. For example checking if two spheres overlap is as simple as
float distance = (1.x - 2.x)*(1.x - 2.x) + (1.y - 2.y)*(1.y - 2.y) + (1.z - 2.z)*(1.z - 2.z);
float buffer = (1.radius + 2.radius) * (1.radius + 2.radius);
If the distance between two spheres is greater than the sum of their radii then we know for certain they do not overlap. For clarification i did NOT square root the distance and instead squared the sum of the radii because that requires less CPU processing. Its an optimization.
In the situation where the spheres DO overlap that only hints that the objects MIGHT overlap depending on orientation and degree of overlapping. For these situations we still DO NOT want to do a prim per prim analysis for multi prim objects. Instead we want to compare 'phase 2' optimized objects.
Phase 1 optimization (the bounding spheres or boxes) should be computed IMMEDIATELY upon linking. Or at a scheduled time (based on sim resource availability) in the immediate future. Phase 2 optimizations would require more intensive computations and should be scheduled to only be computed 'soon' as resources are idle rather than to impede current processing.
For a phase 2 optimization we want to examine the overall geometry of the object. First pass of a phase 2 op would be checking if any individual prims in an object are flagged as phantom. THIS IS A KEY NEED. Prims need to remember phantom status on their own even when within a larger object that is not fully phantom. This allows for things like a steering wheel or stick shift in a car to not worry about collision processing. 2nd step would be a quick comparison to see if any prim is completely contained within another prim. This may be a 'center of mass' adjustment prim or a orientation prim or another reason. These may be visible details on the other side of a semi transparent encasing prim or whatever. They still should not be used in physics checks as the containing prim would get contacted first. Next phase of preprocessing would be to take all the remaining prims and get some 'basic' bounding sectional pieces so that you can use the fewest simple shapes to overall encase the object as a whole.
Once these simple 'sub sections' are computed they would be saved as the phase 2 optimization mesh. The benifit is that these optimized shapes would not take into account any special twist, cut or other morphs. They would be simple boxes or spheres sized and rotated in a manner that it encompasses the whole main object. The math involved to do collision checks against these basic bounding sections is a lot simpler than taking into account all the other details and can be used to quickly prove or disprove a collision has occured, speeding up the collision system.
Some additional scheduled processing could occur in a phase 3 where the phase 2 computed object would be further compared against the 'real' object. If the phase 2 with no morphs applied is computed to be a 'true' enough shape it could be flagged as the 'last stage' meaning the original prims and their various aspects have no need to be used. If significant 'space' is still noticed where a collision would be falsely given then 'percieved collisions' with the phase 2 mesh would then have a prim / prim comparison performed as needed.
If a script within an object causes a prim to physically rotate or move then those prims can have an internal 'dirty flag' applied to them, not visible to the resident (at least not changable by them). Dirty prims would not be used in the optimized phase 2 computations. Until the object could take the time to compute a new phase 1 bounding shape all dirty prims would be checked in addition to the bounding shape. Dirty prims would also no longer be used in the phase 2 multi bounding shape set, but always be checked individually.
All dirty flags are cleared anytime an object is relinked. The 'objects' tab in the editor dialog may even allow a builder to SET a dirty flag on prims they fully intend to have mobile. This will allow all phase processing to disregard those prims from the start saving resources. Manually set dirty prims would be a seperate internal value from the physics computed 'dirty' flag though the manually set one would gaurentee the physics flag is also set.
Since computing these optimizations can be resource intensive a newly linked object should not have to compute them immediately. It should be a scheduled event with a priority setting. High priority for phase 1 optimization and low priority for the more complex phase 2 and 3 checks. The physics engine would only take advantage of optimizations after they are saved so in a worse case scenerio that information may not yet be available and the current system of a prim by prim examination would take place. If an object is copied all of its optimization information should be copied to. Editing 'texture' or 'lighting' fields should NOT invalidate optimizations under any circumstance. Rescaling an object as a whole should not either. Instead a simple rescaling of the optimization meshes should occur. Editing fields on individual prims for size and shape should just immediately 'dirty flag' those prims initially and schedule phase 2 optimizations to be recomputed several minutes AFTER all editing is done. No sense in doing these calculations on an object we know to be undergoing multiple edits.
I would hope that these types of things are already in the works by the programming staff. But depending on how project priorities are currently assigned it might not have been an issue that has come up. Please take the preceeding concepts into consideration.
