Beta 4 : "Tunneling" problem much worse ( solved in RC3 )
by Bruno Grieco · in Torque Game Builder · 05/31/2006 (1:30 pm) · 11 replies
This seemed to have been solve in Beta2 thru scripting :
But now it is much worse. The collision callback is only called when the object is already deep inside a wall. Sometimes creating the "tunneling" efect.
Changing the polygons orientation from cw to ccw or vice versa doens't affect the problem.
IMHO, I beleive that this has something to do with the collision layers. Since I have many overlapped triggers and objects in separate layers, the collision system is wasting time testing for collision between them and is taking too much time to generate the proper collisions.
function PlayerClass::onCollision(%srcObj, %dstObj, %srcRef, %dstRef, %time, %normal, %contactCount, %contacts)
{
%dstclass = %dstObj.class;
if(!(!strcmp(%dstclass,"Region")||!strcmp(%dstClass,"Foot")))
echo("collision with " @ %dstClass );
if(!strcmp(%dstclass,"Wall")||!strcmp(%dstClass,"Block"))
{
%srcObj.setAtRest();
%dstObj.setDebugOn(5);
}
}But now it is much worse. The collision callback is only called when the object is already deep inside a wall. Sometimes creating the "tunneling" efect.
Changing the polygons orientation from cw to ccw or vice versa doens't affect the problem.
IMHO, I beleive that this has something to do with the collision layers. Since I have many overlapped triggers and objects in separate layers, the collision system is wasting time testing for collision between them and is taking too much time to generate the proper collisions.
About the author
#2
06/20/2006 (1:52 pm)
I can't concur... this bug still remains in the final version. :(
#3
06/20/2006 (2:13 pm)
If you are having a problem with your object having such a collision response, check to make sure that your collision poly encompasses the center point of the object.
#4
06/20/2006 (2:16 pm)
Oh.. is that *really* necessary? I was told that this is most likely the cause but it *should* be working anyhow. But if it is such a big prob I guess I have to modify my images...
#5
06/20/2006 (3:17 pm)
Yep, it is necessary. The collision system will return reversed normals in some cases if the center point is not a part of the collision poly. This isn't so much a bug as much as a limitation. The collision poly editor should probably try to enforce this, though.
#6
www.garagegames.com/mg/forums/result.thread.php?qt=46138
06/20/2006 (3:18 pm)
It can happen even with the center point within the collision poly in RC3, im about to upgrade to the release version, read my last post herewww.garagegames.com/mg/forums/result.thread.php?qt=46138
#7
%obj.setCollisionMaxIterations(%num);
by default it's 1. Try upping it to 3 or 4.
06/20/2006 (3:34 pm)
@James: have you tried configuring the collision max iterations on your objects with this function%obj.setCollisionMaxIterations(%num);
by default it's 1. Try upping it to 3 or 4.
#8
06/20/2006 (5:32 pm)
For all the object or just the moving one? I think I tried that before with no luck, but I'll get back to you.
#9
06/21/2006 (10:34 am)
I tried it again and it did not fix the problem. What is setcollisionmaxiterations even for?
#10
06/22/2006 (9:03 am)
I beleive the collision algorithm works by calculating something thru an interactive approximation method. At each iteration the value should be more precise. Thus raising this value would yield a more precise collision result.
#11
resolution systems in a single frame.
06/22/2006 (9:06 am)
It sets the maximum number of iterations that will be taken through the collision detection andresolution systems in a single frame.
Torque Owner Bruno Grieco
The setAtRest() function is no longer needed