Game Development Community

TileLayer Side Collisions

by Nathan Piazza · in TGB Platformer Kit · 07/31/2008 (6:10 pm) · 3 replies

I'm new to Torque, so forgive me if this is a dumb question. I'm using the PSK and TGB 1.7.4.

I'm having trouble getting side/wall/horizontal collisions to work on TileLayer objects with the standard Platform behavior. I have three TileLayers forming a rectilinear basin. The character can stand on top of any of them - he doesn't fall through from above - so far so good - but he CAN walk through the sides. If I add in separate SceneObjects, on top of the TileLayers, and assign THEM the Platform behavior, it works the way I want it to.

But it seems silly that I would have to add separete SceneObjects for every TileLayer just to get wall collisions. After all, aren't TileLayers just children of SceneObjects anyway? Is there something different about the way TileLayers and SceneObjects handle collisions that would explain the inconsistency with which they react to being assigned the Platform behavior?

In the demo, SceneObjects are used for collisions instead of TileLayers, but the stated reason for doing so is because TGB supports only convex hull collisions, and the example terrain TileLayer is concave. Thus, for the single concave TileLayer in the example, 3 convex SceneObjects are used to do the collisions. This makes sense, but in the general case, I would think that you could simply assign the platform behavior to the TileLayers themselves, yes?

I fired up the Torsion debugger, and it appears to me that the onCollision code is never even being run when a collision happens on a TileLayer - and that's where it appears that the lateral movement stoppage for the Actor is being performed. Is the collision event not being fired for the sides of TileLayers?

Thanks,
Nathan

#1
07/31/2008 (7:13 pm)
You must use the PlatformBehavior on a t2dSceneObject because of the way they are set up. They will not work with tile collisions at all.
#2
07/31/2008 (7:32 pm)
Thanks, Phillip. I had a hunch this was the case. Could you elaborate a bit on why this is so? Do TileLayers have a different event model or callback structure?
#3
07/31/2008 (7:37 pm)
Thanks, Phillip. I had a hunch this was the case. Could you elaborate a bit on why this is so? Do TileLayers have a different event model or callback structure?