28.07.2017, 22:17
(
Последний раз редактировалось arad55; 28.07.2017 в 22:51.
)
I'm trying to attach objects to the first object, but it seems to be messing it up.
So, when creating the objects, everything looks fine, but when attaching objects 2-6 to object 1, it won't work and I calculate the offsets accordingly, at least I think.
That's the code I create the objects with:
And that's the code I attach the objects in a different command:
So, when creating the objects, everything looks fine, but when attaching objects 2-6 to object 1, it won't work and I calculate the offsets accordingly, at least I think.
That's the code I create the objects with:
pawn Код:
for(new i=0; i<sizeof(NukeObject); i++)
{
if(NukeObject[i][ObjID] == 0 || !IsValidObject(NukeObject[i][ObjID]))
NukeObject[i][ObjID] = CreateObject(NukeObject[i][ModelID], NukeObject[i][PosX], NukeObject[i][PosY], NukeObject[i][PosZ], NukeObject[i][PosRX], NukeObject[i][PosRY], NukeObject[i][PosRZ]);
}
pawn Код:
for(new i=1; i<sizeof(NukeObject); i++)
{
if(i > 0)
{
new Float:tposx = NukeObject[i][PosX]-NukeObject[0][PosX], Float:tposy = NukeObject[i][PosY]-NukeObject[0][PosY], Float:tposz = NukeObject[i][PosZ]-NukeObject[0][PosZ];
new Float:tposrx = NukeObject[i][PosRX]-NukeObject[0][PosRX], Float:tposry = NukeObject[i][PosRY]-NukeObject[0][PosRY], Float:tposrz = NukeObject[i][PosRZ]-NukeObject[0][PosRZ];
AttachObjectToObject(NukeObject[i][ObjID], NukeObject[0][ObjID], tposx, tposy, tposz, tposrx, tposry, tposrz, 1);
}
}