Hey guys, Im doing character movement on my server, and I see that is flickering some times, dno why. Im using 60fps update on client and 30fps on server (physicsworld).
Video showing the problem:
https://puu.sh/zBdGu/2826b16857.mp4
Node Settings:
Map Floor settings:
Node * pMapNode = pScene->CreateChild( pMap->GetName(), LOCAL );
pMapNode->SetPosition( Vector3( 0, 0, 0 ) );
pMapNode->SetScale( Vector3( 1.0f, 1.0f, 1.0f ) );
auto * pBody = pMapNode->CreateComponent<RigidBody>();
pBody->SetFriction( 1.0f );
auto * pShape = pMapNode->CreateComponent<CollisionShape>();
pShape->SetTriangleMesh( GetSubsystem<ResourceCache>()->GetResource<Model>( pMap->GetBaseMap()->GetFileName() ) );
Character Mover on Server:
Node * pCharacterNode = GetNode();
auto * pCharacterBody = pCharacterNode->GetComponent<RigidBody>();
const Controls & cControls = pConnection->GetControls();
const Vector3 & cVelocity = pCharacterBody->GetLinearVelocity();
Quaternion cRotation( 0.0f, cControls.yaw_, 0.0f );
Vector3 cMoveDirection = Vector3::ZERO;
Vector3 cPlaneVelocity( cVelocity.x_, 0.0f, cVelocity.z_ );
if( cControls.buttons_ & CHARACTERCONTROL_Forward )
{
cMoveDirection += Vector3::FORWARD;
pCharacterNode->SetRotation( cRotation );
}
if( cMoveDirection.LengthSquared() > 0.0f )
cMoveDirection.Normalize();
pCharacterBody->ApplyImpulse( cRotation * cMoveDirection * 1.0f );
Vector3 cBrakeForce = -cPlaneVelocity * 0.1f;
pCharacterBody->ApplyImpulse( cBrakeForce );
Thanks!