Collision detection on large meshes

Blitz3D Forums/Blitz3D Programming/Collision detection on large meshes

Grovesy(Posted 2005) [#1]
Hi there.

I'm having trouble working out the bet way to create my terrains. I originally thought about having loads of pre-made terrain tiles that can be pieced together to make a larger map. The advantage of this is collision detection only needs to be done against the terrian tile they are on, also level creation is easier. The disadvantage is lack of lightmapping on the pre-made pieces.

Another idea would be to create my map from one large terrain, then I can lightmap the level. I think the only real disadvantage of this is that the collision detection now has to be againsts this large (with probably 1,000's of polys) single terrain mesh!

What are peoples thoughts on this?
How are other people approching this problem?

Regards


jfk EO-11110(Posted 2005) [#2]
maybe you could use an invisble mini-terrain (btw are you taling about terrain or mesh?) that is recreated frequently, whenever the player reaches a new mini-cluster. The miniterrain has the same shape as the big terrain, only its only a few meters big, enough to cover the ground the player is walkng on. If this is a blitz terrain, it may be easy to implement it, simply determin the terrainX and Z of the position. Tho not sure if this will be slow, but when you do it not every loop, but only when the player reaches a new cluster (maybe something 3*3 based) then it could be useful.

Of course, this way you would only do collision checks with the mini terrain, that is alphaed to zero.


Grovesy(Posted 2005) [#3]
I guess im really talking about meshes. well with the first, tile based example any way.

I have just seen the Swift Shadow System (http://www.blitzbasic.com/toolbox/toolbox.php?tool=87) which i might be able to use on my mesh terrain tile system when loading the level. Has anyone had any experience with this tool? Is it any good? would it work quick enough so as not to make my level load times stupidly long?

Cheers


OJay(Posted 2005) [#4]
swifts shadow system is pretty useless for outdoor scenes, because of the lack of directional lights. also, its not feasable for large objects, shadows get very blurry then...

for indoor scenes its the best, though!


MadJack(Posted 2005) [#5]
Grovesy

Yeah - if your terrain mesh's too large, you'll find you have intermittant collision failures. Also, the further your mesh from 0,0 the greater the chances of col failure as well.

My terrain mesh is 4096x4096 units. I have tanks that use 4 pivots each (set to sliding collisions on the terrain) and collision works 99.9% of the time. Occasionally one of the pivot points will fall through the terrain mesh and the tank begin to tip up. However, I have some code that does a linepick if at least 2 other pivot points report terrain collisions.

Another approach is to not use a 1m = 1 blitz unit scale but to 'miniaturise' everything e.g. 1m = .1 blitz unit. That might be worth thinking about.


BlackJumper(Posted 2005) [#6]
swifts shadow system is pretty useless for outdoor scenes


... I seem to remember someone using it for a golf game {possibly rsbrowndog ?} and rating it as very useful. Maybe sswifty can throw further light (directional or otherwise)...