   Speed issues when detecting collisions ^^
  Hi every1 out there!I'm developing a 3D game (XNA) & i'm having a speed issue.Basically, i load 5/6 models (simple objects as cactuses, 1 chair, etc), 1 animated player, a skybox, a terrain (i take the heightmap from a greyscale bitmap file & draw the vertices) & lately i added 3 rooms (models) that contain many objects (meshes).So one room has floor, walls, windows, decoration, etc. I create a collision detector (BoundingBox) per object (mesh) & then i check if the player collided to any of them.if the player collided, i move him back -5.After adding this iterations: all meshes in all models against all player collision detectors (i reduced them to one, but anyway), the game runs slow. Very slow.I noticed that i iterate thru all of this to check the collisions & then in the Draw method i again iterate thru all the model meshes to draw them.I know i'm wasting a lot of resources there, but if i check for collisions in the draw iterations, then if it's possitively a collision I should handle the player movement in there... & it's really a mess because i don't have there the movement vector or anything...Smth I'm considering to implement is: before checking for all the objs in a room, be sure that the player is contained inside this room (if so, i won't check in the other rooms). This may lower a bit the consumption. But i'm not sure if it will definately solve the problem.Also: moveVector*=-5 is not very... good. Is it there any better method? (there has to be, i put -5 just because, lol, but it's not very... precise ^^)THANKS A LOT!!!!Synth.   
  Hierarchy!1) spatial partition. Break up the world so you only check collisions vs objects near an area.2) Bounding volumes.  Make every check very rough. (ray vs AABB)  Once you think you have some collision at that level, if you need more info check down deeper. That can mean checking against tighter bounding volumes or the mesh itself.3) Differentiate collision meshes from visual meshes.  Visually you need lots of triangles. Gameplay collisions don't usually care as much. To so extent you might need detail (where to put a bullet decal), but to a larger extent you only care about very coarse details in collision. A wall may have tonnes of pipes in it (lots of collision to check for a bullet decal) but your player is 1.5m tall and only cares that those pipes block his path (so one quad that covers the entire wall of pipes might suffice).;  Thanks Travis,I'll try to put in practice ur advices! The hierarchy idea sounds good to me.Thank u 4 ur help!   