Game Development Community

Legacy Terrain Collision not working

by Jeremiah Fulbright · in Torque Game Engine Advanced · 04/28/2009 (8:02 pm) · 6 replies

With all of the problems we've been having with Atlas, I've been looking to experiment with MegaTerrains/Legacy to see if it would do what we need.

Lo and behold, it seems theres issues with it too. I've grabbed the stronghold.ter and features.ter files to try with and it seems our player won't collide with them.

Projectiles do fine and Player collides fine on Interiors etc.. but not on Legacy Terrains.

In TerrainBlock::BuildConvex
if (box.maxExtents.z < -TerrainThickness || box.minExtents.z > fixedToFloat(gridMap[BlockShift]->maxHeight))
      return;

Seems to be being hit and returning, but not sure what is causing it to not work properly, since I'm using terrains that came with TGEA.

Any help would be appreciated.


#1
04/28/2009 (10:11 pm)
Thats odd... if stock TerrainBlocks didn't collide with the player then the T3D demo mission wouldn't work at all... and it does.

Have you maybe modified ShapeBase or the Player class?
#2
04/28/2009 (10:21 pm)
Surely that's not out-of-the-box behavior.

EDIT: what Tom said. Note to self: hit refresh if time passes before posting.
#3
04/28/2009 (10:38 pm)
Nothing in the player class yet, (working on merging in the changes, but testing things first thus coming across this)... Shapebase, theres been a little bit, but none of the collision code.

It does make it to where it calls BuildConvex on the TerrainBlock from the Player Class, so its obviously making it to that point.

In the case of the BuildConvex, is "box" referring to the players bounding box or the terrain's bounds? I was thinking it might be our bounds size, since things are a bit smaller, but I bumped it up a little higher with same results
#4
04/28/2009 (10:47 pm)
Quote:is "box" referring to the players bounding box or the terrain's bounds?

It depends on the context of who started the call to buildConvex(), but in general the incoming box is the area which you want convex collision data for. From player this is triggered by Convex::updateWorkingList() which is getting the Player's bounds stretched along the current velocity vector.

Are you using a custom Player object? Could you maybe have the player bounds set to something invalid in the datablock?
#5
04/28/2009 (10:57 pm)
For the class we spawn (which is a regular Torque Player object), the bounding box on it is

boundingBox = "1.2 1.2 2.4";

So, I would imagine its going to be the 2.4 that is causing the issue, but that scale wise should be within the extents for terrain.. which I think TerrainThickness is 0.5 or something, and not sure about what the other value turns into

#6
05/05/2009 (10:51 pm)
For future reference to you future people reading this thread, Jeremiah found and reported the underlying cause of this bug here: www.garagegames.com/community/forums/viewthread/90285