I’m looking again at performance in my current project, and it appears that I may have a new bugbear: Collision.
Specifically, use of the new PStats shows a significant amount of time–about 12ms or so–being spent in “Show code:collisionLoop”, and specifically, most of that time being taken up by six passes.
[edit]
Ah, I forgot to attach a screenshot of the PStats flame chart. Here it is:
[/edit]
I’ve tried detaching environmental colliders associated with rooms that are not the current room, nor one of its neighbours, to no apparent effect (at least by looking at the frame-time).
(Accidentally detaching all environmental colliders did have a noticeable effect on frame-time… understandably. ^^; )
Similarly, switching from individual colliders to multiple solids within a single collider seemed to have no appreciable effect.
(Again, accidentally misplacing them did seem to have an effect–presumably as a result of their being culled away in a broad-phase sweep.)
For reference, my environmental colliders are all capsules or (occasionally) spheres, as best I recall, and I think that my character-colliders are all spheres or (occasionally) capsules. Projectiles are capsules–but the testing was performed with no projectiles present, as far as I’m aware.
The test was performed with the player sitting still in a room, with the camera likewise still. There might have been some active enemies, but they should have been likewise still, I think (due to being out of range).
Does anyone have any insight into what might be causing so much time to be spent in collision? And what are these six passes…?