Is this possible?
#1

Is this possible? I can't figure out how if it is... Maybe somebody can help me with this you?

In picture car is driveing. The driver is random player. And I want make a custum camera which will show driving from different angle. Basically look at the picture and instuction below.



A: Player

B: Car

C: Custum camera

D: Point for Custum camera.

Camera C will watch on camera D and both cameras will follow driving vehicle or player.
Reply
#2

Yes it is..

You just need to use

https://sampwiki.blast.hk/wiki/GetPlayerPos

here is some example..

pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    new Float: X, Float: Y, Float: Z;
    GetPlayerPos(playerid, X, Y, Z);
    SetPlayerCameraPos(playerid, X, Y, Z + 20);
    SetPlayerCameraLookAt(playerid, X + 5, Y, Z);
    return 1;
}
Reply
#3

Awesome!! Thanks alot kizla.
Reply
#4

Hmm... Camera does not follow driving vehicle or player. It doeas not refreshes.
Reply
#5

Yes, you would need an very fast timer or you use OnPlayerUpdate
pawn Код:
public OnPlayerUpdate(playerid) {
    if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER) {
        new
            Float: X,
            Float: Y,
            Float: Z,
            Float: A;
        GetPlayerPos(playerid, X, Y, Z);
        GetPlayerFacingAngle(playerid, A);
        SetPlayerCameraPos(playerid, X, Y, Z + 20);
        SetPlayerCameraLookAt(playerid,
            X - (floatsin(A, degrees) * 5),
            Y + (floatcos(A, degrees) * 5),
        Z);
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)