Terrain Collision fix for underground levels
by Peter J. Fischel · in Torque Game Engine · 09/08/2001 (8:31 pm) · 6 replies
Ok... this may seem a bit cheesy of a way to fix the problem with impacting terrain inside underground buildings even though you do not see the terrain.. so .. here is a work around.
In terrCollsion.cc add this line at about line 16
bool groundtest;
around line 212 you will have ...
void TerrainConvex::getPolyList(AbstractPolyList* list)
{
add this
if (groundtest)
{
at the end of that procudure, you will need to ...
faceStart += 4;
}
add this
} // if groundtest
ok... in terrdata.cc around line 27 put
extern bool groundtest;
around line 800 you will see...
if (state->isTerrainOverridden() == false)
render = state->isObjectRendered(this);
else
render = true;
//add this
groundtest = render;
sorry if you hate the way I fixed this... but hey .. it works
In terrCollsion.cc add this line at about line 16
bool groundtest;
around line 212 you will have ...
void TerrainConvex::getPolyList(AbstractPolyList* list)
{
add this
if (groundtest)
{
at the end of that procudure, you will need to ...
faceStart += 4;
}
add this
} // if groundtest
ok... in terrdata.cc around line 27 put
extern bool groundtest;
around line 800 you will see...
if (state->isTerrainOverridden() == false)
render = state->isObjectRendered(this);
else
render = true;
//add this
groundtest = render;
sorry if you hate the way I fixed this... but hey .. it works
About the author
#2
09/08/2001 (10:04 pm)
I suppose if you wanted to, you could. Or make this 3 minute fix and not have to worry about messing with the map. I tried cutting holes. Found that very agrivating. Since the engine deals with this problem anyway, why not just use it? :)
#3
That's one thing I dislike having to do when I'm adding interiors. I have to flatten out the terrain (if I don't want to cut holes) or cut large chunks in the terrain.
Usually, that's not perfect so this seems like a neat way to get around it.
04/14/2002 (2:07 pm)
Cool, I'm going to take a look at this.That's one thing I dislike having to do when I'm adding interiors. I have to flatten out the terrain (if I don't want to cut holes) or cut large chunks in the terrain.
Usually, that's not perfect so this seems like a neat way to get around it.
#4
Likewise, if I try to come back up the stairs walking backwards or shuffling right or left, then it works fine. But if I try to walk back up the stairs going forward then I'm caught.
I'm going to try to find a solution to this but don't know how long it's going to take.. if someone else has found one already please let me know.
11/12/2002 (5:13 am)
this "kind of" works. On a flat surface lets say you have a house with a basement and all you see from the outside is the first level. If I walk down the stairs going forward or shuffling left or right then it works fine. If I try to go down the stairs walking backwards it doesn't work at all.Likewise, if I try to come back up the stairs walking backwards or shuffling right or left, then it works fine. But if I try to walk back up the stairs going forward then I'm caught.
I'm going to try to find a solution to this but don't know how long it's going to take.. if someone else has found one already please let me know.
#5
This kind of works, while I was working a LOT with the terrain collision code to disable terrain tiling, I came back to this thread and decided it would be a lot easier. This methog should make holes like a cookie cutter instead of having to disable collision on the whole tile.
But...
It doesn't. I didn't go that deep into it, but I think it relies too much on the rendering code. There was just something funny about it, I can't really remember. Like, if you were looking at the ground, it would still collide, but if you looked up, you'd fall through...
I don't remember :\ If you get it to work, you should post it here ;)
11/14/2002 (6:20 pm)
Weird, I thought I posted something else in this thread awhile back...This kind of works, while I was working a LOT with the terrain collision code to disable terrain tiling, I came back to this thread and decided it would be a lot easier. This methog should make holes like a cookie cutter instead of having to disable collision on the whole tile.
But...
It doesn't. I didn't go that deep into it, but I think it relies too much on the rendering code. There was just something funny about it, I can't really remember. Like, if you were looking at the ground, it would still collide, but if you looked up, you'd fall through...
I don't remember :\ If you get it to work, you should post it here ;)
#6
This is going to be a problem for me. :((
Cause with the mod I'm building ... most of the missions are underground. As in, I already got my level designer working on a 5 floor building with only 1 level above ground. Its a bunker.
I hope someone can fix this. 8-)
Alex
11/17/2002 (2:12 am)
Oh no!!!This is going to be a problem for me. :((
Cause with the mod I'm building ... most of the missions are underground. As in, I already got my level designer working on a 5 floor building with only 1 level above ground. Its a bunker.
I hope someone can fix this. 8-)
Alex
Torque Owner Chris "Dark" Evans
Dark