PlayerCameraPos
#1

How can I set Camera Positing near player's foot, looking towards sky? I tried this (don't roll your eyes haha)

pawn Код:
if(strcmp(cmd, "/test", true) == 0)
    {
        new X,Y,Z;
        GetPlayerPos(playerid, Float:X,Float:Y,Float:Z);
        SetPlayerCameraPos(playerid,X,Y,0);
        SetPlayerCameraLookAt(playerid, X,Y,Z+10);
        return 1;
    }
To be honest I didn't know what I did but when I tested it my samp was lagging and some strange effects was going on hahah... so how should I place camera near player foot looking up towards sky?
Reply
#2

Well now I tried to make object and attach it to player and attach camera to that object, but I can't make it so camera will look in front of player.. how can I make it?

pawn Код:
if(strcmp(cmd, "/test", true) == 0)
    {
        new Float:x, Float:y, Float:z;
        GetPlayerCameraPos(playerid, Float:x, Float:y, Float:z);
        new playerobject = CreateObject(playerid, 19300, 0.130999, 0.063999, 0.139000, 0.000000, 0.000000, 0.000000);
        AttachObjectToPlayer(playerobject,playerid,0.130999, 0.063999, 0.139000, 0.000000, 0.000000, 0.000000);
        SetPlayerCameraLookAt(playerid,x,y,z+10);
        TogglePlayerControllable(playerid,0);
       
        AttachCameraToPlayerObject(playerid, playerobject);
       
        return 1;
    }
Here is the code what I tried but Camera isn't looking in front of player :/
Reply
#3

Have you ever heared about
pawn Код:
GetXYInFrontOfPlayer(playerid, &Float:x, &Float:y, Float:distance)
{
    new Float:a;
    GetPlayerPos(playerid, x, y, a);
    GetPlayerFacingAngle(playerid, a);
    if (GetPlayerVehicleID(playerid))
    {
      GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
    }
    x += (distance * floatsin(-a, degrees));
    y += (distance * floatcos(-a, degrees));
}
Reply
#4

Never :S

So what to put in than if I will use GetXYInFrontOfPlayer?
pawn Код:
SetPlayerCameraLookAt(playerid, what I need to put in here?);
Reply
#5

Bump
Reply
#6

C'mon what parameters should I put if I use GetXYInFrontOfPlayer or.. how to make that camera will be placed near player's head looking in front of him? :/
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)