29.07.2017, 00:59
Okay I found out AttachObjectToObject offsets are really messy in the code itself, I don't know what's causing it really.
If someone is interested about how I fixed it:
So, generally everything is meant to be calculated by attachedobj - mainobj XYZs. But, it seems to not work that way, so I debugged it ingame quite some time, and found out that Y, Z and RZ offsets should be calculated the other way around, by mainobj - attachedobj.
Also, when attaching the object, the parameters are not (x, y, z, rx, ry, rz), they are actually (y, z, x, y, z, x).
Enjoy
If someone is interested about how I fixed it:
pawn Код:
new Float:tposx = NukeObject[i][PosX]-NukeObject[0][PosX], Float:tposy = NukeObject[0][PosY]-NukeObject[i][PosY], Float:tposz = NukeObject[0][PosZ]-NukeObject[i][PosZ];
new Float:tposrx = NukeObject[i][PosRX]-NukeObject[0][PosRX], Float:tposry = NukeObject[i][PosRY]-NukeObject[0][PosRY], Float:tposrz = NukeObject[0][PosRZ]-NukeObject[i][PosRZ];
AttachObjectToObject(NukeObject[i][ObjID], NukeObject[0][ObjID], tposy, tposz, tposx, tposry, -tposrz, tposrx, 1);
Also, when attaching the object, the parameters are not (x, y, z, rx, ry, rz), they are actually (y, z, x, y, z, x).
Enjoy