OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Wildebeest on 03 Oct 2005, 08:34:52
-
I would like an object to act as a "tail" on a vehicle.
Unfortunately, this is the best I've come up with:
#loop
tail setdir getdir vehicle
tail setPos [(getPos vehicle select 0) - 1.2, (getPos vehicle select 1) + 1.2, 0]
~0.05
goto "loop"
The only problem with this little script is that the "tail" does not stay behind the vehicle. I know why: the "setPos [(getpos..." line only puts the "tail" like north, south, west or east of the vehicle.
Now, how can I make the "tail" stay behind the vehicle regardless of what direction the vehicle is facing?
Thanks
-
IIRC there is a trailer script in the Editors Depot. That might be adaptable to suit your purposes, or even solve the problem directly.
-
Somtin like this?
_unit = _this select 0
_tail = _this select 1
;distance in rear of vehicle
_dist = -5
#loop
_Xpos = (getpos _unit select 0)+(sin (getdir _unit)*_dist)
_Ypos = (getpos _unit select 1)+(cos (getdir _unit)*_dist)
_tail setpos [_Xpos,_Ypos,(getpos _unit select 2)]
_tail setdir getdir _unit
?! alive _unit : Exit
~.01
goto "loop"
-
I tried the attach script in the editors depot and it worked very well. I just had to change + into - to place the object behind the vehicle.
_xa = 0
_ya = - 2
_za = 0
_unit setpos [(getpos _kidnapper select 0) -((((_xa^2)+(_ya^2))^0.5) * sin (getdir _kidnapper)), (getpos _kidnapper select 1) -((((_xa^2)+(_ya^2))^0.5) * cos (getdir _kidnapper)), (getpos _kidnapper select 2) +_z]
Thanks guys, topic solved
-
if so then you may wish to press the (http://www.ofpec.com/yabbse/YaBBImages/solve.gif) button... ;)
-
Wait a minute before solving this. Totally off topic but what does IIRC mean?
-
LOL I forgot to press it.. hehehe... IIRC means Interactive Illinois Report Card or Image and Identity Research Collective... I dunno..
-
if i remember correctly, it means If I Remember Correctly.
8)