Game Development Community

Loosing my mind over Tile collisions

by Arden · in Torque X 2D · 12/02/2010 (2:07 pm) · 1 replies

Hiya guys,

I'm posting this in case someone has figured it out. Either it's me, or there's something seriously wrong with Tile Collision. Simply said, I have a ball. That ball has the basic physic and collision component, and bounces off walls. If I instanciate two identical tile maps, one on top, the other on the bottom, and I run the following code:

ReadOnlyArray<T2DTileObject> arrayOfCollTiles;
arrayOfCollTiles = Tilemap.GetCollisionMatches(ourObject);

... each time a collision occurs, I get three hits on top (closer to the ball, or Y+1) and six in the bottom (3 closer to the ball (Y=0), and then 3 at(Y+1)).

This creates lots of glitches, as I'm trying to destroy these tiles as they are hit in a reliable way. Do I have to find a hack for this somehow, or did any of you experiment with this and found a fix?

Thanks




#1
12/03/2010 (6:57 pm)
Never mind, figured it out. GetCollisionMatches only seems to handle the first tiles hit on the outside of a Tile Map. As for the problem described above, I only restrict my matches to the first 3 hits in any direction.

So the way I had to do this, as most of you are already doing I'm sure, it that I have multiple tile maps, each with their own unique type. So far, it does not seem to impact performance much and it's easier to handle on the level design side, so I'll just do that.