Collision Confusion With Layers and Groups
by David Mulkerrins · in Torque Developer Network · 12/07/2009 (9:15 am) · 0 replies
I noticed that a lot of people especially noobs like myself are having trouble in understanding the collision system. This might be obvious and it might of been mentioned somewhere but I didn't see it when I was going through the tutorials and docs. So I thought I'll post this to help other people who are having the same difficulty from what I have figured out.
The (collision layers) and (collision groups) found under the (collision) tab in the TGB editor, refer to the two fields (layer) and (group) found under the (scene object) tab.
Whichever scene objects have set or highlighted in blue in their (collision layers) or (collision groups) will only collide with other scene objects that have its (layer) or (group) set to the same number.
i.e. Object A under its (scene object) tab has its (group) set to 3. Object B has its (group) set to 5. Object C under its (collision) tab only has the number 5 highlighted under (collision groups). Object C will only collide with Object B and will pass through Object A. The collision layers work in the same manner.
One thing to note, for an object to respond to a collision and enact its (collision response) such as clamp, bounce etc. The physics send/receive under the (collision tab) must be enabled. Otherwise the system will detect the collision but will do nothing with it and objects will just pass through each other.
Although I don't know a lot about how send/receive part of collisions and physics work I found this out from looking at the tile map object, in that it can only have its collision receive set and not its collision send set. The same seems to apply the physics send/receive.
So a static object in which the player object can collide with such as as a wall or platform needs only its collision receive and physics receive to be set or enabled. The player object needs only to have its collision send and physics send enabled. But this only works for this scenario. Should you want the wall or platform to move when the player collides with it or likewise the player to be effected by the wall or platform then I suspect that the options are going to be setup differently, of what and which way I am not sure of. Perhaps someone could make a post or post a link below to help explain that part.
I hope that this post has been of help to some as I know I've had trouble with this. :)
The (collision layers) and (collision groups) found under the (collision) tab in the TGB editor, refer to the two fields (layer) and (group) found under the (scene object) tab.
Whichever scene objects have set or highlighted in blue in their (collision layers) or (collision groups) will only collide with other scene objects that have its (layer) or (group) set to the same number.
i.e. Object A under its (scene object) tab has its (group) set to 3. Object B has its (group) set to 5. Object C under its (collision) tab only has the number 5 highlighted under (collision groups). Object C will only collide with Object B and will pass through Object A. The collision layers work in the same manner.
One thing to note, for an object to respond to a collision and enact its (collision response) such as clamp, bounce etc. The physics send/receive under the (collision tab) must be enabled. Otherwise the system will detect the collision but will do nothing with it and objects will just pass through each other.
Although I don't know a lot about how send/receive part of collisions and physics work I found this out from looking at the tile map object, in that it can only have its collision receive set and not its collision send set. The same seems to apply the physics send/receive.
So a static object in which the player object can collide with such as as a wall or platform needs only its collision receive and physics receive to be set or enabled. The player object needs only to have its collision send and physics send enabled. But this only works for this scenario. Should you want the wall or platform to move when the player collides with it or likewise the player to be effected by the wall or platform then I suspect that the options are going to be setup differently, of what and which way I am not sure of. Perhaps someone could make a post or post a link below to help explain that part.
I hope that this post has been of help to some as I know I've had trouble with this. :)