void FCamera::CameraUpdate()
{
// rotation
if (MouseDown(1) && MouseDown(2))
{
pivotRot.Y -= mouseDX/5;
RotateEntity(pivot, pivotRot);
}
else
{
targetRot = EntityRotation(target);
pivotRot = EntityRotation(pivot);
dist = targetRot.Y - pivotRot.Y;
if (dist > 180) { dist -= 360; }
if (dist < -180) { dist += 360; }
if (abs(dist) > 0.5) TurnEntity(pivot, Vec3(0, dist/7 , 0));
}
RotateEntity(camera, EntityRotation(pivot));
cameraTilt += mouseDY/5;
cameraTilt = Clamp(cameraTilt,-90,60);
TurnEntity(camera, Vec3(cameraTilt, 0, dist/2));
// position
PositionEntity(pivot, EntityPosition(target));
MoveEntity(pivot, Vec3(0, cameraPivotHeight, 0));
PositionEntity(camera, EntityPosition(pivot));
MoveEntity(camera, Vec3(0, 0, -distToPlayer) );
}
I have some camera delay after player's rotation. But when i send demo to another team member, he says that they are too little and asked to change delay in 2 times, so i changed it from
if (abs(dist) > 0.5) TurnEntity(pivot, Vec3(0, dist/7 , 0));
to
if (abs(dist) > 0.5) TurnEntity(pivot, Vec3(0, dist/14 , 0));
When i asked about FPS, he says that he got 300 fps, when i have only 140 fps...
So, looking like i need some solution, that would make gameplay independent from Fps. Any ideas?