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



AttachObjectToObject - nejc001 - 28.01.2012

How the hell can i attach object to another object that fits like i want?

i got like this now.. "ship" is the main object and i want to attach shipp1 and shipp2 to "ship"..

i did this: "ship"(pos/rot) - "shipp1"/"shipp2"(pos/rot)

but when in game the object doesn't fit right.. -.-

pawn Код:
ship = CreateObject(10794, 2960.53, -2041.31, 7.00,   0.00, 0.00, 90.00);
shipp1 = CreateObject(10793, 2960.42, -2116.40, 35.57,   0.00, 0.00, 90.00);
shipp2 = CreateObject(10795, 2960.49, -2043.60, 17.14,   0.00, 0.00, 90.00);
AttachObjectToObject(shipp1,ship,-0.11,-75.09,28.557,0,0,0,1);
AttachObjectToObject(shipp2,ship,-0.04,-2.29,10.14,0,0,0,1);

anyone got idea how to calculate pos and rot right?


Re: AttachObjectToObject - Da' J' - 28.01.2012

You should use a good map editor... Like MTA has. What you use?


Re: AttachObjectToObject - nejc001 - 29.01.2012

JernejL's map editor.


Re: AttachObjectToObject - nejc001 - 03.02.2012

bump


Re: AttachObjectToObject - Babul - 03.02.2012

if you attach an object, the potition and rotation is RELATIVE to the first object (parent), so its the best way to map it how you want, then subtract the position ship from position ship2 (rotation too, but you can do that later):
Код:
position x y and z:
ship:   10.0   20.0   0.0
ship2: 15.0   08.0   0.0
do that math now:
15-10=5
8-20=-12
0-0=0
..so your offset to attach ship1 to ship, is 5.0, -12.0, 0.0


Re: AttachObjectToObject - nejc001 - 03.02.2012

you mean what i basicly did here:
pawn Код:
ship = CreateObject(10794, 2960.53, -2041.31, 7.00,   0.00, 0.00, 90.00);
shipp1 = CreateObject(10793, 2960.42, -2116.40, 35.57,   0.00, 0.00, 90.00);
AttachObjectToObject(shipp1,ship,-0.11,-75.09,28.557,0,0,0,1);
2960.42 - 2960.53 = -0.11

.
.
.
still it doesnt work, i checked if the objects are right without AttachObjectToObject and they are.
But when i attach, ill show the screens when i get home.


Re: AttachObjectToObject - thimo - 03.02.2012

Are you trying to make a ferry or something like my server? If yes you dont need to attach them just place them right


Re: AttachObjectToObject - ғαιιοцт - 03.02.2012

Wtf! I didn't know this function existed!
This will be really handy!


Re: AttachObjectToObject - nejc001 - 03.02.2012

Quote:
Originally Posted by thimo
Посмотреть сообщение
Are you trying to make a ferry or something like my server? If yes you dont need to attach them just place them right
I want to create a moving ship, thats why they need to be attached.


Re: AttachObjectToObject - thimo - 03.02.2012

Quote:
Originally Posted by ғαιιοцт
Посмотреть сообщение
Wtf! I didn't know this function existed!
This will be really handy!
ғαιιοцт yet learned another thing xD