Home   Help Search Login Register  

Author Topic: Airfield tractor (whats the name of this thing?)  (Read 3069 times)

0 Members and 1 Guest are viewing this topic.

Offline myke13021

  • Contributing Member
  • **
  • Myke
Airfield tractor (whats the name of this thing?)
« on: 13 Aug 2007, 00:47:24 »
Hello,

i would need a script for a special purpose:

i want to have a car (or several cars) to push/pull empty planes on an airfield thus giving the possibility to push an damaged airplane into a hangar to get it repaired/refueled/rearmed. Also if you ever "parked" a plane against a wall, such a script could come in handy.

I hope you get the point: a car (Datsun, Hilux, whatever) can attach a plane (maybe check for position relative to plane, avoiding attaching on the side) and push/pull it around.

i already tried with the velocity/setvelocity commands, transferring the speed of the car on the plane but this worked only if car wouldn't make a turn.

As i'm not too bad in scripting, with math i can be killed very easy and this is IMHO a mathematic problem. So if someone could write such a script for me...well, in fact i just can say "thank you" but i would kiss your feet if i could...literally  :D

Oh, and believe me, i'm absolutely not such a guy "i need this, do it for me" but here i'm affraid i'm going nowhere without your help.


Myke out.
« Last Edit: 13 Aug 2007, 02:48:41 by myke13021 »

Offline JasonO

  • OFPEC Patron
  • ****
  • Oh no...
    • The New Life RPG
Re: Airfield tractor (whats the name of this thing?)
« Reply #1 on: 13 Aug 2007, 02:18:06 »
Its called a Tug. :)



A trailer script would do the job. I believe there was some in OFP, you could have a look at them I guess.

I would't know where to start because like you said, it's ok keeping the vehicle in a certain direction, but turning makes it look wrong and not attached (i've tried and failed).
Don't just do it for myke, but me too! :D
* JasonO bets Mandoble finds a solution.
« Last Edit: 13 Aug 2007, 02:26:57 by JasonO »

Offline firecontrol

  • Members
  • *
Re: Airfield tractor (whats the name of this thing?)
« Reply #2 on: 13 Aug 2007, 02:41:26 »
Lol. I suggest that this section of the forums be renamed "Ask Dr. Mandoble." instead of Editing/Scripting General. ;)

But seriously, have you tried modifying the Mando Chaser script?

Offline JasonO

  • OFPEC Patron
  • ****
  • Oh no...
    • The New Life RPG
Re: Airfield tractor (whats the name of this thing?)
« Reply #3 on: 13 Aug 2007, 02:42:55 »
That just calculates direction and velocity etc to take the chaser to the unit its following i thought, it wouldnt 'tug' it would it?

http://www.flashpoint1985.com/cgi-bin/ikonboard311/ikonboard.cgi?s=1080915a76b4a576e70120473641ab6c;act=ST;f=69;t=65161

I see that, but thats actually not a script but an addon meathod of sticking a pin into a hole so the models lock, and using the geometry LOD to keep them in place. It's not scripted unfortunatly :(
« Last Edit: 13 Aug 2007, 02:47:40 by JasonO »

Offline myke13021

  • Contributing Member
  • **
  • Myke
Re: Airfield tractor (whats the name of this thing?)
« Reply #4 on: 13 Aug 2007, 02:46:41 »
yep, JasonO, thats exactly what i meant. My nphew is kinda genius in math and asked him to help me...also he did but it seems i understood it completely wrong. My approach was first to keep up the plane pointed to the car. But as ArmA doesn't provide a command like "getheadingtootherobject" my nephew tried to explain me something about vector calculations (flyby, has this word a meaning for you?). First i thought i had understand it and tried to put it in a script. Well, kinda it worked....got a SU34 and me placed straight north of it...then i launched the script which shouldn't do anything that changing the dir of the plane, pointing at me. Result was: it posed the plane straight facing east (dir 90), then i took 2! steps sideways (looking south to the plane) and the plane disappeared. There i was, standing on the Rahmadi runway, feeling like Copperfield, making a jetplane go to Nirvana. Well, thats how far i was going.

My next idea would have been, getting the speed of the car and transfer it to the plane with some fancy math code to keep the distacne between them. No need to tell you how far i am....btw. try this: place player as driver in car and an empty plane, make a short script which gets the velocity of the car and setvelocity to the plane 1 on 1...(yes, i know this can't work but i needed a point to start at)..then preview and drive around...looks kinda funny but isn't helpful at all.

Well, wrote all this to say: i really tried to see how far i can get with my knowledge and the conclusion is: nowhere.


Myke out.

*Myke counts on Mandoble, his scripts are just awesome


:EDIT:
hmm...forgot to look into this one as it seemed for me so completely different...anyway, will take a look into it and if! i can understand what goes on there and if! i find a way, i'll try it with the chaser script.
« Last Edit: 13 Aug 2007, 02:48:54 by myke13021 »

Offline JasonO

  • OFPEC Patron
  • ****
  • Oh no...
    • The New Life RPG
Re: Airfield tractor (whats the name of this thing?)
« Reply #5 on: 13 Aug 2007, 02:48:35 »
Have you tried SetRelPos? That would make the plane solid behind the tug, and would seem to drag it more than tow it.

That sets an objects position around another object even if the object rotates, the other object rotates so its always in the same position as the object.

Offline myke13021

  • Contributing Member
  • **
  • Myke
Re: Airfield tractor (whats the name of this thing?)
« Reply #6 on: 13 Aug 2007, 02:56:13 »
SetrelPos? Couldn't find such a command in the Comref.

Anyway, i guess such a SetRelPos wouldn't avoid the plane to slide sidewys if the car makes a turn. Too bad you can't access the front wheel to make it really steerable...and the some nifty setvelocity calculations would have give a nice and smooth effect...but as i said...too sad.

Another question...well in fact more a "why did they forget that @ BIS"...why doesn't it has a setspeed command? this velocity is pretty useless if you don't understand vector calculations. A simple command that sets a vehicle speed (in fact exactly was setvelocity does, but in relation to vehicles heading, not in world coordinates, though) would be so handy.

Anyway, i hope some of the math and scripting guru come up with something.

Mandoble, i count on you  :D


Myke out

Offline JasonO

  • OFPEC Patron
  • ****
  • Oh no...
    • The New Life RPG
Re: Airfield tractor (whats the name of this thing?)
« Reply #7 on: 13 Aug 2007, 03:01:22 »
Might be talking out my ass again (its 2am lol)

There is a command anyhow, I just can't freeking remember it.

Ahhh.. http://www.ofpec.com/COMREF/index.php?action=list&game=All&letter=m#modelToWorld - ModelToWorld

The thing is, I can't remember the syntax :(

Maybe something like
Code: [Select]
_pos = getpos _obj
_worldpos = _obj ModelToWorld _pos
_obj2 setpos _worldpos

Then you would do the offset by adding or subtracting the distance you want in the position array (in _worldpos)
« Last Edit: 13 Aug 2007, 03:03:52 by JasonO »


Offline JasonO

  • OFPEC Patron
  • ****
  • Oh no...
    • The New Life RPG
Re: Airfield tractor (whats the name of this thing?)
« Reply #9 on: 13 Aug 2007, 03:04:20 »
WTF? Too fast to be true  :o

 :good:

Nice one Mandoble.

Looks like Myke's thread is solved.. do I win my bet?  :whistle:
« Last Edit: 13 Aug 2007, 03:12:32 by JasonO »

Offline firecontrol

  • Members
  • *
Re: Airfield tractor (whats the name of this thing?)
« Reply #10 on: 13 Aug 2007, 03:19:24 »
Brilliant! Hahaha.

JasonO: What I was referring to was that some of the same math would likely be involved, so you could pick apart the mando chaser scripts... but:

Solved it seems anyway. Nice job as always Mando.  :good:

Offline myke13021

  • Contributing Member
  • **
  • Myke
Re: Airfield tractor (whats the name of this thing?)
« Reply #11 on: 13 Aug 2007, 20:33:37 »
Well, what can i say:  :clap: :good:

excellent and brilliant as usual, thx Mandoble


well, in this case:


- SOLVED -