Turn off collision callback on a tile-by-tile basis [Solved]
by Max Kielland · in Torque Game Builder · 10/01/2009 (8:40 am) · 5 replies
Hello, again and in the right forum this time ;)
I'm working on a platform idea and are using a tile layer. I need a way to turn of the collision callback for "normal tiles" I walk on (hence need the collision poly to prevent falling thru) and only have my "special" tiles to actually do the collision callback.
So far I have only managed to turn of collision callback for all or none of the tiles.
Also, when I "stand" on a tile the callback is called over-and-over-and-over... again. I only want it to be called once for each time I make contact witht he tile and then stop during the contact duration (more like an enter tile / leave tile event per tile). As long I'm stading on a tile, TGB is now spamming my callback function.
Any way to achive this?
I'm working on a platform idea and are using a tile layer. I need a way to turn of the collision callback for "normal tiles" I walk on (hence need the collision poly to prevent falling thru) and only have my "special" tiles to actually do the collision callback.
So far I have only managed to turn of collision callback for all or none of the tiles.
Also, when I "stand" on a tile the callback is called over-and-over-and-over... again. I only want it to be called once for each time I make contact witht he tile and then stop during the contact duration (more like an enter tile / leave tile event per tile). As long I'm stading on a tile, TGB is now spamming my callback function.
Any way to achive this?
About the author
Owner of MK Development www.mkdevelopment.se
#2
It seems like the collision must be active to have the physics working (preventing things from falling through).
What I'm trying right now is to test if this is the first collision with this tile and immediately return from onCollision() if it is.
The problem is that the onCollision is being spammed all the time and I'm worried about the FPS rate :/
Any other suggestions?
10/01/2009 (8:48 pm)
I have tried this already and as soon I turn off the collision my player just falls down through the tile.It seems like the collision must be active to have the physics working (preventing things from falling through).
What I'm trying right now is to test if this is the first collision with this tile and immediately return from onCollision() if it is.
The problem is that the onCollision is being spammed all the time and I'm worried about the FPS rate :/
Any other suggestions?
#3
Also, don't worry about the framerate until it's a problem. It can spam onCollision() a lot without being a problem. Particularly if you're only talking about the main character (and not 100's of objects).
10/03/2009 (4:49 am)
Is it falling because you have gravity turned on for that object? You'd have to turn off gravity until your character moves up/down if that is the case.Also, don't worry about the framerate until it's a problem. It can spam onCollision() a lot without being a problem. Particularly if you're only talking about the main character (and not 100's of objects).
#5
10/07/2009 (8:11 pm)
I'm using triggers instead, suits my needs better :)
Torque 3D Owner Lance Hampton
See:
tdn.garagegames.com/wiki/TGB/Reference:_t2dTileLayer#setTileCollisionActive.28.2...