--
[ Picked text/plain from multipart/alternative ]
So I'm doing bots for Fortress Forever and I have run into a problem that
appears to be a bug with the game. The odd thing is that I can't reproduce
it myself as a player, and so far have only observed it happen to the bot
players. There is a func_door being used as a lift, and when someone gets
under the lift, when it comes down and hits the player it will go back up.
The problem is that when the bot gets underneath just once, the lift is
stuck in a perpetual up and down oscillation. After some debugging it became
clears that the problem was physics related, since the physics system was
calling CCollisionEvent::AddTouchEvent every time the lift came down, even
though the bot had already ran off and was nowhere near the lift.

I added some debug drawing stuff in the function
CCollisionEvent::AddTouchEvent, to draw the bounds of the collidable, like
so:

debugoverlay->AddBoxOverlay(
        pEntity0->GetCollideable()->GetCollisionOrigin(),
        pEntity0->GetCollideable()->OBBMins(),
        pEntity0->GetCollideable()->OBBMaxs(),
        pEntity0->GetCollideable()->GetCollisionAngles(),
        255,
        0,
        255,
        0,
        10.0f);

    debugoverlay->AddBoxOverlay(
        pEntity1->GetCollideable()->GetCollisionOrigin(),
        pEntity1->GetCollideable()->OBBMins(),
        pEntity1->GetCollideable()->OBBMaxs(),
        pEntity1->GetCollideable()->GetCollisionAngles(),
        255,
        0,
        255,
        0,
        10.0f);

Here is a picture of that.
http://i8.tinypic.com/258z4zk.jpg

As you can see, the collidables bounding boxes at least are where they
should be, and not touching. The small red lines under the lift are the
collision position and collision normal also passed to the function, so
there is clearly something being registered as hitting.

After digging around for more stuff I came across the cvar
physicsshadowupdate_render, and when enabled finally showed the problem.
http://i7.tinypic.com/258z5u8.jpg

The rendering for these boxes is in CBasePlayer::VPhysicsShadowUpdate. The
blue box is the players IPhysicsObject->GetPosition(), the red box is at the
GetAbsOrigin() of the character. Clearly they are out of sync. These boxes
should be pretty much together, but for some reason they aren't. I noticed
the comment at the bottom of the function that reads

// UNDONE: Force physics object to be at player position when not touching
phys???

Why was this undone? Anyone know what part of the code is responsible for
keeping the physics synced with the entity and vice versa? Stepping through
the code in CBasePlayer::VPhysicsShadowUpdate How could these get out of
sync like this? I haven't been able to reproduce this as a player, only
happens to the bot so far, but I can't see any reason at all that it would
be bot related. We aren't messing with the physics for the bot in any way.
This is really annoying. Any feedback is appreciated.

Jeremy
--

_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders

Reply via email to