SA-MP Forums Archive
Interpolating camera pos and lookat doesnt always work propertly - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Interpolating camera pos and lookat doesnt always work propertly (/showthread.php?tid=410977)



Interpolating camera pos and lookat doesnt always work propertly - pasha97 - 27.01.2013

In my server, when player connects and starts selectiong skin, hic camera moves slowly to the place of selecting. But it doesn't always work propertly. Sometimes camera stops on a half of a way. Here is a code:

pawn Код:
new is1st[MAX_PLAYERS];

public OnPlayerRequestClass(playerid, classid)
{
if(IsPlayerNPC(playerid)) return SpawnPlayer(playerid);
    TextDrawShowForPlayer(playerid,Text:Box);
    TextDrawShowForPlayer(playerid,Text:Box2);
                if(is1st[playerid]==0)
                {
                InterpolateCameraPos(playerid, 2030.1234,1567.5530,29.6463, 2008.1212,1664.7034,14.2188, 5000, CAMERA_MOVE);
                InterpolateCameraLookAt(playerid, 2028.5165,1553.5148,30.8905, 2005.2192,1669.0897,12.7685, 5000, CAMERA_MOVE);
                is1st[playerid]=1;
                }
    SetPlayerPos(playerid, 2005.2192,1669.0897,12.7685);
    SetPlayerFacingAngle(playerid, 228.7617);
    SetPlayerSpecialAction(playerid,SPECIAL_ACTION_DANCE3);
    CreateExplosion(2005.2192,1669.0897,12.7685, 11, 2.0);
    return 1;
}

public OnPlayerRequestSpawn(playerid)
{
    is1st[playerid]=0;
    return 1;
}

public OnPlayerConnect(playerid)
{
is1st[playerid]=0;
return 1;
}



Re: Interpolating camera pos and lookat doesnt always work propertly - MP2 - 27.01.2013

Sometimes it stops, sometimes it skips. It's a frame rate issue with GTA: SA. I reported it in the 0.3e RC stage but nothing got done. It completely ruins this feature.


Re: Interpolating camera pos and lookat doesnt always work propertly - pasha97 - 27.01.2013

Quote:
Originally Posted by MP2
Посмотреть сообщение
Sometimes it stops, sometimes it skips. It's a frame rate issue with GTA: SA. I reported it in the 0.3e RC stage but nothing got done. It completely ruins this feature.
So, what shall i do with it? I see many servers, there is such feature, but i've never seen this bug there. As an example, United Islands Freeroam. It is very popular, and they use interpolating camera this way too.


Re: Interpolating camera pos and lookat doesnt always work propertly - James Coral - 27.01.2013

pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
if(IsPlayerNPC(playerid)) return SpawnPlayer(playerid);
    TextDrawShowForPlayer(playerid,Text:Box);
    TextDrawShowForPlayer(playerid,Text:Box2);
                if(is1st[playerid]==0)
                {
                InterpolateCameraPos(playerid, 2030.1234,1567.5530,29.6463, 2008.1212,1664.7034,14.2188, 5000, CAMERA_MOVE);
                InterpolateCameraLookAt(playerid, 2028.5165,1553.5148,30.8905, 2005.2192,1669.0897,12.7685, 5000, CAMERA_MOVE);
                is1st[playerid]=1;
                }
             else if(is1st[playerid]==1)
             {
    SetPlayerPos(playerid, 2005.2192,1669.0897,12.7685);
    SetPlayerFacingAngle(playerid, 228.7617);
    SetPlayerSpecialAction(playerid,SPECIAL_ACTION_DANCE3);
    CreateExplosion(2005.2192,1669.0897,12.7685, 11, 2.0);
           }
    return 1;
}



Re: Interpolating camera pos and lookat doesnt always work propertly - pasha97 - 27.01.2013

Quote:
Originally Posted by James Coral
Посмотреть сообщение
pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
if(IsPlayerNPC(playerid)) return SpawnPlayer(playerid);
    TextDrawShowForPlayer(playerid,Text:Box);
    TextDrawShowForPlayer(playerid,Text:Box2);
                if(is1st[playerid]==0)
                {
                InterpolateCameraPos(playerid, 2030.1234,1567.5530,29.6463, 2008.1212,1664.7034,14.2188, 5000, CAMERA_MOVE);
                InterpolateCameraLookAt(playerid, 2028.5165,1553.5148,30.8905, 2005.2192,1669.0897,12.7685, 5000, CAMERA_MOVE);
                is1st[playerid]=1;
                }
             else if(is1st[playerid]==1)
             {
    SetPlayerPos(playerid, 2005.2192,1669.0897,12.7685);
    SetPlayerFacingAngle(playerid, 228.7617);
    SetPlayerSpecialAction(playerid,SPECIAL_ACTION_DANCE3);
    CreateExplosion(2005.2192,1669.0897,12.7685, 11, 2.0);
           }
    return 1;
}
If i use this, when player will connect, he won't see the character the first time.