Help With Lua

fsmodding
Posts: 140
Joined: Tue Oct 30, 2012 9:20 pm
Contact:

Help With Lua

Post by fsmodding »

Hello

Im a newbie at lua and was looking for some help

i working on a trailer and would like to get the a transform in this trailer to always point in the same direction of the tractor along its x Axis.. if the tractor turns i want the transform to rotate so its always targeting the x axis at it.

How would i go about achieving this. ???
Image
Image
fruktor
Former GIANTS employee
Posts: 109
Joined: Thu Nov 05, 2009 12:48 pm

Re: Help With Lua

Post by fruktor »

Hi,

when I understand you correctly you want to align a TG in a trailer so that its x axis always points towards the tractor?

Check the script doumentation at GDN:
http://gdn.giants-software.com/document ... ipting.php

There are a lot of commands listed which you can use.

As soon as the trailer is attached you can use the following variable to have "access" to the tractor:
self.attacherVehicle


Cheers,
fruktor
fsmodding
Posts: 140
Joined: Tue Oct 30, 2012 9:20 pm
Contact:

Re: Help With Lua

Post by fsmodding »

thanks for the reply Fruktor, but i have no idea where to start with lua. Also Yes you understand properly a transform in my Trailer should have its X axis always point at the tractor.
Image
Image
User avatar
bassaddict
GIANTS Software | Web/Script Programmer
Posts: 11983
Joined: Tue Nov 29, 2011 2:44 pm
Location: ER, DE

Re: Help With Lua

Post by bassaddict »

Could you explain what exactly you want to achieve? Because there's always at least one part pointing towards the tractor (i.e. drawbar to attacher).
fsmodding
Posts: 140
Joined: Tue Oct 30, 2012 9:20 pm
Contact:

Re: Help With Lua

Post by fsmodding »

bassaddict wrote:Could you explain what exactly you want to achieve? Because there's always at least one part pointing towards the tractor (i.e. drawbar to attacher).
yes i know about the drawbar but at slow speeds there can be a offset, so i would like to make a tranforms X Axis is Always pointing at the Tractor.
Image
Image
fruktor
Former GIANTS employee
Posts: 109
Joined: Thu Nov 05, 2009 12:48 pm

Re: Help With Lua

Post by fruktor »

:hi:

well ... first of all you should understand how to insert a new script into a vehicle.

As soon as you have a new script you can get started ;)

- get (world) position of (which?) reference node at the tractor
- transform these coordinates into the local space of the part you want to align (actually to the parent of this part ;) )
- align
- done :biggrin2:

You might also make use of drawDebugPoint/Line to visualize some of the results.


Still, the question remains what you exactly want to do?
Improving the drawbar? In which situations exactly? Might be a hard job ;)

Cheers,
fruktor
User avatar
bassaddict
GIANTS Software | Web/Script Programmer
Posts: 11983
Joined: Tue Nov 29, 2011 2:44 pm
Location: ER, DE

Re: Help With Lua

Post by bassaddict »

Hydraulic hoses: There's already a script for that. At least for FS13. I don't know if the original modders already converted the script to FS15, but even if not, you would still have a good base to start with.
That mod is available on FS-UK. Don't know the exact name, but shouldn't be hard to find.
DanRan
Posts: 228
Joined: Fri Dec 05, 2014 6:11 pm
Location: Iceland

Re: Help With Lua

Post by DanRan »

PC user
Post Reply