Game Development Community

173 World Limit Issues

by Kevin James · in Torque Game Builder · 05/25/2008 (4:44 pm) · 12 replies

Setting "RIGID" world limit response results in some strange behavior. If the normal force is near perpendicular to one of the sides of the world limit, then the object will bounce whichever way it pleases. This is kind of irrelevant, because "BOUNCE" mode works perfectly fine.

What isn't irrelevant is the fact that objects going from rest to, say, about 150 wu/s will go straight through the world limit and not look back. I wouldn't be concerned if the limit was closer to 600 wu/s or even more, but 150 wu/s isn't real fast. Are there any settings I can tweak that will perhaps bump this limit up a little? Any other suggestions?

About the author

Computer security, digital forensics, and platform jumper enthusiast. shells.myw3b.net/~syreal/


#1
05/26/2008 (3:04 am)
Kevin,

Could you provide a little scripted example to show your problem in more detail?

Melv.
#2
05/26/2008 (5:27 pm)
Throw this level into the TutorialBase game folder in TGB 173:

%levelContent = new t2dSceneGraph() {
   canSaveDynamicFields = "1";
   UseLayerSorting = "1";
   layerSortMode0 = "Normal";
   layerSortMode1 = "Normal";
   layerSortMode2 = "Normal";
   layerSortMode3 = "Normal";
   layerSortMode4 = "Normal";
   layerSortMode5 = "Normal";
   layerSortMode6 = "Normal";
   layerSortMode7 = "Normal";
   layerSortMode8 = "Normal";
   layerSortMode9 = "Normal";
   layerSortMode10 = "Normal";
   layerSortMode11 = "Normal";
   layerSortMode12 = "Normal";
   layerSortMode13 = "Normal";
   layerSortMode14 = "Normal";
   layerSortMode15 = "Normal";
   layerSortMode16 = "Normal";
   layerSortMode17 = "Normal";
   layerSortMode18 = "Normal";
   layerSortMode19 = "Normal";
   layerSortMode20 = "Normal";
   layerSortMode21 = "Normal";
   layerSortMode22 = "Normal";
   layerSortMode23 = "Normal";
   layerSortMode24 = "Normal";
   layerSortMode25 = "Normal";
   layerSortMode26 = "Normal";
   layerSortMode27 = "Normal";
   layerSortMode28 = "Normal";
   layerSortMode29 = "Normal";
   layerSortMode30 = "Normal";
   layerSortMode31 = "Normal";
   DebugRendering = "33";
      cameraPosition = "0 0";
      cameraSize = "100 75";

   new t2dStaticSprite(test) {
      imageMap = "shipImageMap";
      frame = "0";
      canSaveDynamicFields = "1";
      Position = "-1.373 1.850";
      size = "6.795 6.370";
      WorldLimitMode = "BOUNCE";
      WorldLimitMin = "-42.919 -31.811";
      WorldLimitMax = "43.625 31.836";
      CollisionActiveSend = "1";
      CollisionActiveReceive = "1";
      CollisionCallback = "1";
      CollisionDetectionMode = "CIRCLE";
      CollisionResponseMode = "BOUNCE";
      ConstantForce = "0.000 40.000";
      ConstantForceGravitic = "1";
      MaxAngularVelocity = "0";
         mountID = "2";
   };
};

Then run the level and do something like this in the console:

test.setImpulseForce(0, 150);

150 may or may not cause the world limit to be ruptured, but 300 will definitely rip a hole in space time. A curious thing is that I could apply a force of 10,000 to the default box polygon, but the circle's yield is much smaller. I'm okay with a linear velocity limit of 100; I'm worried that on slower computers, the yield will be much smaller, say 50 or so.

I apologize for not bringing this up during the beta stage. I was extraordinarily busy during the 173 beta, and ironically have only gotten time to mess around with TGB after the beta.
#3
05/29/2008 (6:28 pm)
Melv,

Does this level suit your fancy? I could send my pong demo if you'd prefer that. Its a little more fun.
#4
05/30/2008 (2:13 pm)
Sorry for the late reply, this should be fine. It's going to take me a day or so to get around to this now as I've ran out of time this evening.

Melv.
#5
06/03/2008 (2:53 am)
Kevin,

Getting a little swamped with TGB stuff at the moment so I've just logged this bug report for later.

The bug report reference is "TGB-91".

Melv.
#6
06/03/2008 (4:43 am)
Its cool, Melv. I've started to use two different workarounds. The first is two layers of immovable, collision receiving only static sprites that seem to be doing a good job at keeping the ball in the arena. The second, is an out of bounds detector, that nullifies the ball when it gets out of bounds.

It'd be nice for the world limit to be impenetrable, but all in due time. ;)
#7
11/17/2008 (7:19 am)
Kevin,

I know it's been months since the last comment here but I have been resolving lots and lots of bug reports and I've just moved onto this one.

Assuming you can remember; do you recall if you're seeing the rendering of the object interpenetrating the world-limit but the actual collision bounds doesn't.

The reason I ask is because using your example above on several machines I see the same thing which is the object "seemingly" consistently interpenetrating the world-limits.

if you turn-on the debug rendering for the bounding-box (the actual render area) and the collision bounds (the physics area) then you notice one important thing: the physics area never interpenetrates the world-limit but the render area consistently does!!

68.233.5.139/~transfer/melvstuff/tgbworldlimitpenetration.jpg
Red: Collision Bounds Yellow: Render Bounds


I believe this is related to the next render tick-interpolation not being updated after a collision so that the rendering continues on to its next tick position for the next tick.

I am hoping that this is what you're seeing because it seems to have all the symptoms of what you have described so far.

I will continue to work on this problem until I have resolved it. If you have any further information then it would be very helpful if you could post it ASAP.

Thanks!

Melv.
#8
11/17/2008 (7:53 am)
I have resolved this issue (assuming it's the same one) and have submitted it to the internal repository. It will be available in the next release.

If you have the source code, the change is trivial. Look for the method:
void t2dSceneObject::integrateObject( const F32 sceneTime, const F32 elapsedTime, CDebugStats* pDebugStats )
in t2dSceneObject.cc.

Inside this function is the following code:
// Mounted?
    if ( processIsMounted() )
    {
        // Yes, so update mount.
        // NOTE:-   We'll update the tick position based upon the mount!
        updateMount( elapsedTime );
    }
    else
    {
        // Update Tick Position.
        getParentPhysics().updateTickPosition();
        // Update Tick Rotation.
        getParentPhysics().updateTickRotation();
    }

    // Update World Limit ( if required ).
    if ( getIsWorldLimitActive() && !editting)
    {
        updateWorldLimit( elapsedTime );
    }

Simply transpose the "mounted" and "world-limit" code block like so:
// Update World Limit ( if required ).
    if ( getIsWorldLimitActive() && !editting)
    {
        updateWorldLimit( elapsedTime );
    }

    // Mounted?
    if ( processIsMounted() )
    {
        // Yes, so update mount.
        // NOTE:-   We'll update the tick position based upon the mount!
        updateMount( elapsedTime );
    }
    else
    {
        // Update Tick Position.
        getParentPhysics().updateTickPosition();
        // Update Tick Rotation.
        getParentPhysics().updateTickRotation();
    }


Note that this fixes the issue as demonstrated by the image above. It doesn't fix anything else so if something else is occurring then please let me know ASAP so that I can look into it.

Melv.
#9
11/17/2008 (2:04 pm)
Melv,

Thanks for the response. I have not tried your code replacements, but my issue was that the ball would totally penetrate the world limit, go to the other side of the world limit, and continue moving as if there was no world limit. Basically, it seemed that the world limit was simply a box that could be broken through, given enough force and a circle type collision detection. It does have to be going pretty fast though, realize that.

Thanks,
Kevin
#10
11/18/2008 (4:13 am)
Kevin,

I tried setting velocities on the order of 10,000 world-unit/sec and I have not got that effect. Was this with circle and/or any particular polygon? I didn't spend an awful long time trying to force something to interpenetrate the limit though. I'll try that again using some other variations.

If you do have any form of example then I would love to use it to test.

Again, thanks for your help!!

Melv.
#11
11/30/2008 (4:13 pm)
Hey Melv,

I cannot get a consistent example to work, but when I do, it is going 10,000 world-unit/sec and it has circle detection on. It is nearly impossible to see; I do not even know if it is actually penetrating. The problem must have been fixed in a release, or I accidentally fixed something in script. I don't know. I will let you know if I can get my hands on a consistent example.

Thank you
Kevin.
#12
11/30/2008 (10:03 pm)
Thanks!