How to fix kickbacks problem in 0.45.124252?
in this version,when I came out of house, it will kick back.
I compare the source between 0.44.123800 and this version's, then replace the source code in the folder named 'lib'. But it still have the problem.
anyone can tell me how to fix that?
Thanks.
Re: How to fix kickbacks problem in 0.45.124252?
Quote:
Originally Posted by
oklan
in this version,when I came out of house, it will kick back.
I compare the source between 0.44.123800 and this version's, then replace the source code in the folder named 'lib'. But it still have the problem.
anyone can tell me how to fix that?
Thanks.
Just use the 44 , 45 doesn't have any changes ingame , just kickback glitches!
Re: How to fix kickbacks problem in 0.45.124252?
To correct the problem should be compared with the version 0.42.116212. This Corrected easily.
Re: How to fix kickbacks problem in 0.45.124252?
The problem in the file soldierOld.cpp.
Function:
PHP Code:
void Man::Simulate( float deltaT, SimulationImportance prec )
- - - Updated - - -
Editing soldierOld.cpp:
Delete line:
Code:
line 1900:
_lastRemotePos = FutureVisualState().Position();
Code:
line 7694:
if (!_remoteState.IsNull())
{
_lastRemotePos = _remoteState->pos;
}
Change the line:
Code:
line 7949:
static bool doSubdiv = true;
static float subdiv = 0.2f;
float moveDist = prevPos.Distance(moveTrans.Position());
if(doSubdiv && moveDist > (subdiv + 0.01f))
{
const Time backupVCT = _vegCollisionTime;
const bool backupHPC = _highPriorityContact;
const bool backupPPC = _purePersonContact;
const bool backupOC = _objectContact;
ManVisualState collTest(moveTrans);
int nextIter = 0;
int numIter = intMax((int)ceilf(moveDist / subdiv), 2);
Vector3 endPos = moveTrans.Position();
for(int n = 0; n < numIter; n++)
{
collTest.SetPosition(prevPos.Lerp(endPos, (float)n / (numIter - 1)));
const float collVol = ValidatePotentialState(collTest);
// revert any side-effects on member variables
_vegCollisionTime = backupVCT;
_highPriorityContact = backupHPC;
_purePersonContact = backupPPC;
_objectContact = backupOC;
if (collVol > 0.f)
{
break;
}
nextIter = n;
//if (GetNetworkManager().IsClient())
//{
// //CYAN - collision validation on each subdivision
// enf::Shape::CreateSphere(collTest.Position() + 2.f*VUp, 0.03f, 0xff00ccff, enf::SS_ONCE|enf::SS_NOOUTLINE);
//}
}
const int NUM_CLOSE_SUBDIVS = 2; //number of first subdivs considered close
const bool isClientOnly(!GetNetworkManager().IsServerOwner());
bool canTeleport(isClientOnly && (nextIter < NUM_CLOSE_SUBDIVS) && (numIter > NUM_CLOSE_SUBDIVS + 1));
if (canTeleport && !_local)
{
const Vector3 localMoveDir = endPos - FutureVisualState().Position();
const Vector3 remotePosDir = _lastRemotePos - FutureVisualState().Position();
const float projDist = localMoveDir.DotProduct(remotePosDir);
const float sqDistToLocalPos = localMoveDir.SquareSize();
const float sqDistToRemotePos = remotePosDir.SquareSize();
canTeleport = (projDist > 0.f) && (sqDistToLocalPos <= sqDistToRemotePos);
}
if (canTeleport)
{
//if collision place is very close, jump straight to the last position
nextIter = numIter - 1;
}
else if (nextIter < NUM_CLOSE_SUBDIVS)
{
//advance to the next subdivision so that movement can be repaired
nextIter = intMin(nextIter + 1, numIter - 1);
}
float const iterRatio = (float)nextIter / (numIter - 1);
DoAssert(iterRatio > 0.f); // always advance on next iteration
moveTrans.SetPosition(prevPos.Lerp(endPos, iterRatio));
doCollision(deltaT * iterRatio);
}
On these lines:
Code:
static bool doSubdiv = true;
static float subdiv = 0.2f;
float moveDist = prevPos.Distance(moveTrans.Position());
if(doSubdiv && moveDist > (subdiv + 0.01f))
{
int numIter = intMax((int)ceilf(moveDist / subdiv), 2);
Vector3 endPos = moveTrans.Position();
for(int n = 0; n < numIter; n++)
{
moveTrans.SetPosition(prevPos.Lerp(endPos, (float)n / (numIter - 1)));
doCollision(deltaT / numIter);
if(fCollVol > 0 || fVoll > 0)
{
int const closeSteps = 2;
if (n < closeSteps && numIter > closeSteps + 1)
{
//if collision place is very close, jump straight to the last position
n = numIter - 2;
}
else
{
break;
}
}
}
}
Editing soldierOld.hpp:
Delete line:
Code:
line 1247:
Vector3 _lastRemotePos; /**< Last received position of remote player. Used in Simulate() function.
@See #Simulate(float , SimulationImportance )
*/
- - - Updated - - -
Off-topic. I am ready to tell that a lot of change in the sources, but can do so only in Russian, as translated into English requires a lot of time, which is not. If the administration has enabled or someone took it to translate, it would be wonderful.
Re: How to fix kickbacks problem in 0.45.124252?
Thanks, I used another way to fix this problem.
in soilderOld.cpp, dynamic_cast<Zombie>, if sucess, only execute doCollision(deltaT * iterRatio)
- - - Updated - - -
Thanks, I used another way to fix this problem.
in soilderOld.cpp, dynamic_cast<Zombie>, if sucess, only execute doCollision(deltaT * iterRatio)