SA-MP Forums Archive
moveobject / mapping error - 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: moveobject / mapping error (/showthread.php?tid=657119)



moveobject / mapping error - Zeus666 - 01.08.2018

Hi. I want to move the object only by rotation. How can i do that?

PHP код:
CMD:sdgate(playerid, params[])
{
    if(
pInfo[playerid][pFaction] != 1) return SendClientMessage(playerid, COLOR_WHITE, "You are not from Sherrif Department");
    if(
IsPlayerInRangeOfPoint(playerid, 5.0, 125.4551,-130.3049,1.5781))
    {
        
SendClientMessage(playerid, COLOR_LIGHTBLUE, "You have opened the gate. It will close after five seconds.!");
         
MoveObject(barierasd, 122.7600, -134.0119, 1.3161, 0.0000, 90.0000, 0.4000); //barrierturn
         
SetTimerEx("sdgate", 5000, false, "i", playerid);
    }
    else
    {
        
SendClientMessage(playerid, -1, "{FFCC33}You are not near the gate!");
    }
    return 
1;
} 



Re: moveobject / mapping error - Rufio - 01.08.2018

The last 3 parameters in MoveObject are the object's rotations. Try messing with them until you get the rotation you want. The first one is rotation in the X axis, the second one is rotation in the Y axis and last one is Z.


Re: moveobject / mapping error - NaS - 01.08.2018

For the rotation to work the object also needs to be moved, unfortunately.

So, if you want to rotate an object for 1 second, you need to move it by (for example) 0.1 meters at a speed of 0.1 m/s. If you want it to rotate for 3 seconds, move it by 0.3 meters at a speed of 0.1 m/s or 0.1 meters at a speed of 0.03333 m/s.

Just choose the smallest distance possible (so it doesn't become visible) and use the formula t = d/s so you can easily calculate the speed needed for it to move t seconds.