SA-MP Forums Archive
setting object rot - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: setting object rot (/showthread.php?tid=200035)



setting object rot - armyoftwo - 17.12.2010

pawn Код:
SetPVarFloat(playerid, "GPS_X", 2680.8572);
        SetPVarFloat(playerid, "GPS_Y", -1330.0626);
        SetPVarFloat(playerid, "GPS_Z", 42.8088);
       
        GPS_OBJ = CreateObject(1318, 0, 0, 0, 0, 0, 0);
       
        new vehid = GetPlayerVehicleID(playerid);
       
        AttachObjectToVehicle(GPS_OBJ, vehid, 0.0, 0.0, 1.0, 0, 0, 0);
pawn Код:
SetObjectRot(GPS_OBJ,GetPVarFloat(playerid, "GPS_X"),GetPVarFloat(playerid, "GPS_Y"),GetPVarFloat(playerid, "GPS_Z"));
I have this, but it doesn't set object rot


Re: setting object rot - armyoftwo - 18.12.2010

anyone?


Re: setting object rot - [UG]Scripter - 18.12.2010

Lol, Read the SetObjectRot Function...
SetObjectRot(Object,X,Y,Z);


Re: setting object rot - armyoftwo - 18.12.2010

Quote:
Originally Posted by [UG]Scripter
Посмотреть сообщение
Lol, Read the SetObjectRot Function...
SetObjectRot(Object,X,Y,Z);
Read again, i am doing the same thing.
I see that you're not understanding the line


Re: setting object rot - Rachael - 18.12.2010

Without looking at the rest of your script, its difficult for me to understand why you are using PVars for a function that is dealing with vehicle id's and object id's.

You set PVars with what I assume are rotation values
You create an object
You attach the object to a vehicle, which includes rotation values of 0, 0, 0
You set the rotation of the attached object with the values of the previously defined PVars

Why don't you just put the rotation values in the attach object command?

also, try 0.0, 0.0, 0.0 instead of 0, 0, 0 ( worth a try, sometimes it matters )

[edit] Considering object rotation is included in the Attach command, it is quite possible that you simply can't set the rotation of an attached object. Someone who is more familiar with 0.3c may be able to confirm this


Re: setting object rot - armyoftwo - 18.12.2010

I'm trying to make something like this ( see attachment)

the arrow is a object ( ID: 1318 )

So if i can't set object's rotation if it's attached, then i will have to destroy, create, attach and like that all the time. (under 1 sec timer)

pawn Код:
if(GetPVarInt(playerid, "GPS") > 0)
        {
               DestroyObject(GPS_OBJ);
               GPS_OBJ = CreateObject( 1318, 0, 0, 0, 0, 0, 0);

               new vehid = GetPlayerVehicleID(playerid);

               AttachObjectToVehicle(GPS_OBJ, vehid, 0.0, 0.0, 1.5, 2680.8572, -1330.0626, 42.8088);


           
        }
But it doesnt work, because it doesnt change arrow's rotation


Re: setting object rot - armyoftwo - 18.12.2010

anyone?


Re: setting object rot - armyoftwo - 19.12.2010

bump


Re: setting object rot - Rachael - 19.12.2010

you know rotation is in degrees? and 360 degrees is the same as zero?
your rotation values are 2680.8572, -1330.0626, 42.8088?


Re: setting object rot - armyoftwo - 19.12.2010

Код:
Float:fRotX, Float:fRotY, Float:RotZ - Last 3 arguments
It's not in degrees? is it?