Player twitching when TickTime*runForce/mass ratio is low
by Thomas \"Man of Ice\" Lund · in Torque Game Engine · 07/25/2004 (8:27 am) · 5 replies
This is a continuation of this thread in the public area: www.garagegames.com/mg/forums/result.thread.php?qt=19351
I still need to dig a little more into this, but its definitely a problem (bug or feature) when the runForce/mass * TickTime is "low enough"
This piece of code taken from player.cc around line 1525 is called once in a while, even when the player is standing still. But only (or so it seems) when the camera is detached from the player - or at least thats when the twitching starts to be visible.
Dumping data shows that runSpeed fluctuates
And once in a while it gets above the maxAcc (defined as TickTime*runForce/mass). When this ratio is low, then this seems to trigger some animation code (or at least the client prediction)
I'll try to investigate a little more, but shouldnt the runSpeed be 0 when the player stands still?
And how come this only shows when the player is detached, as the runSpeed fluctuates also when attached to the player?
Edit:
BTW - if I comment out the
Edit 2:
(Sorry for taking this one piece at a time, but at some point I cant continue for a while, and recording what I find can maybe help someone else looking into this)
A little more info. This is really weird. Adding debugging around to pinpoint the problem, it actually seems that the engine thinks that the player is falling sometimes even when standing still. Adding a debug message to the following block code
But it does point back to the findContact() in line 2678, that is the one responsible for checking the run/jumpSurface and return the contactNormal
It even has a check for the control object in it, so I think there is an error in here somewhere. But I cant pinpoint what or why.
I still need to dig a little more into this, but its definitely a problem (bug or feature) when the runForce/mass * TickTime is "low enough"
if (runSpeed > maxAcc)
runAcc *= maxAcc / runSpeed;This piece of code taken from player.cc around line 1525 is called once in a while, even when the player is standing still. But only (or so it seems) when the camera is detached from the player - or at least thats when the twitching starts to be visible.
Dumping data shows that runSpeed fluctuates
maxAcc: 0.640000 runSpeed: 0.079293 TickSec: 0.032000 maxAcc: 0.640000 runSpeed: 0.079293 TickSec: 0.032000 maxAcc: 0.640000 runSpeed: 0.576799 TickSec: 0.032000 maxAcc: 0.640000 runSpeed: 0.211342 TickSec: 0.032000 runspeed>maxacc maxAcc: 0.640000 runSpeed: 2.839152 TickSec: 0.032000 runspeed>maxacc maxAcc: 0.640000 runSpeed: 2.187509 TickSec: 0.032000 runspeed>maxacc maxAcc: 0.640000 runSpeed: 1.543843 TickSec: 0.032000 runspeed>maxacc maxAcc: 0.640000 runSpeed: 1.080691 TickSec: 0.032000 maxAcc: 0.640000 runSpeed: 0.210642 TickSec: 0.032000 maxAcc: 0.640000 runSpeed: 0.056612 TickSec: 0.032000 maxAcc: 0.640000 runSpeed: 0.056617 TickSec: 0.032000 maxAcc: 0.640000 runSpeed: 0.056619 TickSec: 0.032000 maxAcc: 0.640000 runSpeed: 0.056617 TickSec: 0.032000 maxAcc: 0.640000 runSpeed: 0.056619 TickSec: 0.032000
And once in a while it gets above the maxAcc (defined as TickTime*runForce/mass). When this ratio is low, then this seems to trigger some animation code (or at least the client prediction)
I'll try to investigate a little more, but shouldnt the runSpeed be 0 when the player stands still?
And how come this only shows when the player is detached, as the runSpeed fluctuates also when attached to the player?
Edit:
BTW - if I comment out the
if (runSpeed > maxAcc) // runAcc *= maxAcc / runSpeed;code, then twitching doesnt show. But I'm pretty sure its just a patch to the problem and not curing the illness
Edit 2:
(Sorry for taking this one piece at a time, but at some point I cant continue for a while, and recording what I find can maybe help someone else looking into this)
A little more info. This is really weird. Adding debugging around to pinpoint the problem, it actually seems that the engine thinks that the player is falling sometimes even when standing still. Adding a debug message to the following block code
if (runSurface)
mFalling = false;
else {
Con::errorf("Falling");
VectorF vel;
mWorldToObj.mulV(mVelocity,&vel);
mFalling = vel.z < sFallingThreshold;
}from around line 1632. This is triggered sometimes even when stading completely still - also when the human is in control. It _seems_ that the player twitching is related to this by subjectively watching the console and the animation ingame at the same time. *shrugs*But it does point back to the findContact() in line 2678, that is the one responsible for checking the run/jumpSurface and return the contactNormal
It even has a check for the control object in it, so I think there is an error in here somewhere. But I cant pinpoint what or why.
#2
Thomas, thanks for investigating this further. This is first on my "Once I get back to Torque..." list to check out. Right now, however, I'm in the middle of finalizing the release of another non-Torque based game.
07/26/2004 (9:58 am)
@Ben: That's my suspicion. Something to do with the control object networking code. The velocity changes are very minute, less than 1/100th, but just enough to trigger the animation code.Thomas, thanks for investigating this further. This is first on my "Once I get back to Torque..." list to check out. Right now, however, I'm in the middle of finalizing the release of another non-Torque based game.
#3
There is definitely a problem with the above mentioned code blocks - or in that area. The animation is triggered in that runSpeed > maxAcc block, but the real problem is that the runSpeed is non-zero in the first place, and fluctuating (while standing still). To the point of the engine even thinking the player is falling down.
07/26/2004 (10:24 am)
David - you can work around it by setting a high runForce - or low mass. Then the twitching stops, but that doesnt really solve the problem itself.There is definitely a problem with the above mentioned code blocks - or in that area. The animation is triggered in that runSpeed > maxAcc block, but the real problem is that the runSpeed is non-zero in the first place, and fluctuating (while standing still). To the point of the engine even thinking the player is falling down.
#4
07/26/2004 (11:14 am)
Have you tried dumping the data from the control object updates?
#5
06/03/2005 (7:22 am)
Sorry to bring back an old thread, but did anyone ever solve this fundamentally? Just curious. I'm looking to fix this issue as well. Thanks!
Associate Kyle Carter