Category | Scripting |
Created | 25.01.2022 05:00 |
. Alexey . (2Alexey2) | 25.01.2022 05:00 |
---|---|
How can I find out via LUA if a device connected to a tractor has a PTO? I want to animate cardan shafts on a tractor. I managed to track if the device is turned on. But if you hook a plow or cultivator to the tractor, it gives the error "getIsTurnedOn() is a nil value" |
Bilbo Beutlin (BBeutlin) | 27.01.2022 10:11 |
---|---|
In most cases you must check at first for a nil value: if self.getIsTurnedOn ~= nil and self:getIsTurnedOn() then ... |
. Alexey . (2Alexey2) | 27.01.2022 16:23 |
---|---|
A good option, but I simple checked if there is a PTO in the a config file if object.ptoInput ~= nil then if object:getIsPowerTakeoffActive() == true then Utils.updateRotationNodes(self, self.ptoRotationNodes, dt, true); else Utils.updateRotationNodes(self, self.ptoRotationNodes, dt, false); end; end; |
. Alexey . (2Alexey2) | 27.01.2022 16:25 |
---|---|
Thanks for reply |
Note: Log in to post. Create a new account here.