SA-MP Forums Archive
GetCheckpointRot? - 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: GetCheckpointRot? (/showthread.php?tid=303188)



GetCheckpointRot? - System64 - 12.12.2011

Hi all

I have a problem, how can I get the rotation of checkpoint?
I saw something like that in this topic
https://sampforum.blast.hk/showthread.php?tid=116622

how he said
Quote:

@Trooper[Y] I use SetObjectRot.With Attach,object too laggy.Iґm tested with many solutions and with SetObjectRot is the best.

I have this
pawn Код:
SetPlayerCheckpoint(playerid, 1215.3896,-1844.5940,13.3828, 4.0);
            CurrentPlayerCP[playerid] = 1;
            DS_Arrow[playerid] = CreateObject(1318,20.20000076,-502.79998779,8.50000000,0.00000000,90.00000000,0.00000000);
            AttachObjectToPlayer(DS_Arrow[playerid], playerid, 0, 0, 1, 0, 90, 2);
            SetObjectRot(DS_Arrow[playerid], 1215.3896, -1844.5940, 13.3828);
So I want to calculate how to get rotation of this cp so I can set that rot on my object?


Re: GetCheckpointRot? - [HiC]TheKiller - 12.12.2011

A checkpoint is circle, there is no need for rotation as all the sides will be the same no matter how you rotate it.


Re: GetCheckpointRot? - System64 - 12.12.2011

Yeah but it still doesn't work, take a look on code, please


Re: GetCheckpointRot? - MP2 - 12.12.2011

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

Look at the parameters, the rotation is there.


Re: GetCheckpointRot? - System64 - 12.12.2011

Yeah I know but look now,
http://zaslike.com/files/tdz1g1effudywve2189j.png
I want it to be rotated to look on that cp, what should I do?
pawn Код:
DS_Arrow[playerid] = CreateObject(1318,20.20000076,-502.79998779,8.50000000,0.00000000,90.00000000,0.00000000);
            SetObjectRot(DS_Arrow[playerid], 1215.3896, -1844.5940, 13.3828);
            ObjectRot[playerid][0] = 1215.3896;
            ObjectRot[playerid][1] = -1844.5940;
            ObjectRot[playerid][2] = 13.3828;
            AttachObjectToPlayer(DS_Arrow[playerid], playerid, 0, 0, 1, ObjectRot[playerid][0], ObjectRot[playerid][1], ObjectRot[playerid][2]);



Re: GetCheckpointRot? - [HiC]TheKiller - 12.12.2011

Are you sure SetObjectRot isn't meant to be MoveObject because I have never seen someone use -1844.5940 degrees.


Re: GetCheckpointRot? - System64 - 12.12.2011

I tried:
pawn Код:
SetPlayerCheckpoint(playerid, 1215.3896,-1844.5940,13.3828, 4.0);
            CurrentPlayerCP[playerid] = 1;
            DS_Arrow[playerid] = CreateObject(1318,20.20000076,-502.79998779,8.50000000,0.00000000,90.00000000,0.00000000);
            AttachObjectToPlayer(DS_Arrow[playerid], playerid, 0, 0, 1, 0, 90, 2);
            GetObjectPos(DS_Arrow[playerid], ObjectPos[playerid][0], ObjectPos[playerid][1], ObjectPos[playerid][2]);
            MoveObject(DS_Arrow[playerid], ObjectPos[playerid][0], ObjectPos[playerid][1], ObjectPos[playerid][2], 3.0, 1215.3896, -1844.5940, 13.3828);
but it doesn't work, I realy don't know what should I do!


Re: GetCheckpointRot? - MP2 - 14.12.2011

You need to use maths including player position, player facing angle and. Checkpoint position.