Collision Holes?
by Thomas Pereira · in Torque Game Builder · 06/10/2007 (11:27 am) · 6 replies
My question is pretty simple. Currently, is there any support for collision holes? That is to say, if you have a body which is collision activated, say a box...then place another object, say a small circle, on top of that box; when a collision activated object collides with only the box, it counts as a collision - but when it touches the circle, there is no collision and the object will proceed with movement. As soon as it touches the box again, however, without the presence of the circle, it acts accordingly. Makes sense? I hope so. So does this capability currently exist?
About the author
#2
06/10/2007 (2:30 pm)
I am aware of how collisions work in TGB, I don't think you understand what I'm saying exactly. I'm not asking if concave polygon support exists; if it did, I could easily script a collision hole system. All I'm asking is if collision holes exist - which in theory would have nothing to do with concave collision detection. If a convex collision occurs on one object set for collision AND another object set for anti-collision, then the object will not see it as a collision. Makes sense? I'm just going to assume this doesn't exist, and try to work it in myself I guess.
#3
But as I tried to describe above, you try to do something similar to the following approach
to achieve a similar result.
The alternative as mentioned is that you really use concave collision polygons on sub objects and create a "non collision area".
depends on your needs which approach is more usefull, normally the later seems to be used to achieve concave collision. (a hole within convex makes it concave, no mather if the hole is in the middle or at its border, sadly)
06/10/2007 (3:12 pm)
No this type of collision detection does not exist, as only a single collision polygon can be on an object so no "anti collision polygon" can exist.But as I tried to describe above, you try to do something similar to the following approach
Quote:Another possibility would be mounting the hole and using a costum collision handler that sets a value on the parent that the child was collided as well.
then in the parents collision callback you check for that one if it is true or false *and reset it to false*
Thats a hacky way and depending on your needs won't give you the desired result ...
Especially you can not use the default collision reactions anymore.
to achieve a similar result.
The alternative as mentioned is that you really use concave collision polygons on sub objects and create a "non collision area".
depends on your needs which approach is more usefull, normally the later seems to be used to achieve concave collision. (a hole within convex makes it concave, no mather if the hole is in the middle or at its border, sadly)
#4
06/10/2007 (5:25 pm)
Well, the point is arguable, I still stand by the statement that my approach is not considered concave. Anyway, my solution in my mind for now will sacrifice accuracy. I intend to simply use a tilemap with no graphics overlaying the objects to simulate. Not what I wanted, but I guess it will have to do.
#5
06/11/2007 (8:04 am)
Why don't you test what you were saying?
#6
06/11/2007 (11:56 am)
Good question.
Torque 3D Owner Marc Dreamora Schaerer
Gayasoft
Collision polygons do not allow concave objects and a hole within an object would be concave.
What you can do is split your quad with hole up into sub collision objects parented to your object and use them as collision receiver (can be a little tricky to get it correctly aligned)
Another possibility would be mounting the hole and using a costum collision handler that sets a value on the parent that the child was collided as well.
then in the parents collision callback you check for that one if it is true or false *and reset it to false*
Thats a hacky way and depending on your needs won't give you the desired result ...
Especially you can not use the default collision reactions anymore.
Such kind of collision checks *holes in objects* are very performance consuming on polygon collisions, they are mainly usefull for pixel collision which on the other hand does not allow usefull physical reaction ...