I'm not sure if you're doing this or not; but do not collision check the terrain, this can be done with a few raycasts. (Which are much faster; as you've figured out). The problem checking for collisions is that it runs through a loop of every triangle and checks it against every other triangle in the model. So if you're checking one triangle against the 8192 poly one, that's 8192 checks. If you're checking two thats 8192*2, if three thats 8192*3 and so on...
***Add this, it'll increase speeds alot***
***For objects only; does not work for the level***
Only do a collision check if there is a collision on the X,Y axis. This can be done with a circle sprite (equal to the radius of the model) and the collision event (make sure its NOT solid, or you'll have GM reacting to collisions on the X,Y axis). Then in the collision event check for collisions with p3dc (Collision event will not be precise on the X,Y axis and does not take the Z into account, however using it in combination with p3dc can be powerful and will improve speeds)
There are also other ways to overcome this (I'm sure there's more, but this is what I'd do).
A: Make the models lower poly (if possible), this will reduce the number of checks needed (a little change on the big models does not effect it as much as little changes on the smaller models; however it all helps)
B: Split your levels/models (collision model) into many smaller ones (X,Y axis only), and collision check against the only needed one. Then create one big models to use for raycasting (contains everything). So for example say you had a 64x64 terrain, split that into a 8x8 array of models, each containing pieces of the large one corresponding to the position on the large one.
Also make it larger (+1,-1) on the sides/top bottom so that the spots will slightly overlap.
This does not have to be done by hand, and should be done inside of a loop.
model[0,0] contains the height spots [0-8,0-8] for the heights
model[1,0] contains the height spots [7-17,0-8] for the heights
model[2,0] contains the height spots [15-25,0,8] for the heights
model[6,3] contains the height spots [41-51,23-33] for the heights
then when checking what model to compare to...
and collision check against that.
C: Use a couple raycasts and shoot them out of the that each face of the cube is pointing
BTW: I don't plan on adding the groups; I looked at them, and it would be faster to do with GML
Edited by brett14, 20 October 2009 - 01:40 AM.