Game Development Community

Popping through walls

by Craig Perko · in Torque Game Builder · 03/12/2008 (1:01 pm) · 5 replies

I'm sure this has been asked before, but I can't seem to find it, so I'll ask it myself.

I'm using tilemaps, and I'm having lots of troubles. I would complain about the common issues, but I have bigger problems:

I have players that can walk through walls.

The player is roughly the same size as a tile. He uses a triangular collision poly (because circles malfunction). He walks on the ground, jumps, etc. I even have fun code for clinging to walls.

But if the player goes into a corner and jumps while pressing towards the wall, he breaks through the wall. Specifically, he enters the wall and the game goes apeshit, propelling him up and through.

In order to keep this from happening, I have to give the player a very, very slow max speed, which obviously isn't a useful solution. (With a circle collision, even a low speed has errors like this.)

What's going on? How do I fix it?

-Craig

Edit: If I give him a square collision, it seems to fix the problem? Torque malfunctions on triangles?

#1
03/12/2008 (1:49 pm)
As far as I can tell, this is related to the fact that a tilemap is a single object. When you encounter two tiles at once, you only collide with one object. The engine does know that you encountered it at two points: it says "contacts = 2" and gives you four entries in "points".

But the NORMAL doesn't get this treatment. You only get ONE normal, and it's apparently pretty arbitrary as to which of the two normals you get.

Has anyone solved this problem? Am I going to have to use the "points" to handle these literal corner cases?

-Craig
#2
03/13/2008 (7:34 pm)
I think it's something I solved without even knowing I was solving this problem.
By setting "player.setCollisionMaxIterations(3);" it allows the player to compute multiple collisions at once. It resolve a bunch of problems you could have for a platformer.
#3
03/13/2008 (7:41 pm)
Right now it's set to two. I'll try three tomorrow. Hope it works!
#4
03/26/2008 (10:59 am)
Yes, the max iterations allows multiple collisions to be handled during each physics tick. The default of one can be insufficient in some cases, especially when you're moving across tiles with constant-forces being applied.

The recent round of collision fixes may solve other related issues.

Melv.
#5
05/14/2008 (1:26 pm)
Craig,

I was working on a similar platform game, (are you stealing my ideas??) and I encountered the same issue with the tilemaps. My solution was to make collision polygons from t2dSceneObjects and lay them over top of the tile maps. Benjamin's idea seems to be a little more practical. How did it work for you?

Thanks,
Kevin

P.S. The tilemap morphing happened no matter what the collision polygon was, quadrilateral, rectangle, etc.