Community Forum

Attacher joint don't move

Forum Overview >> Farming Simulator 15

CategoryFarming Simulator 15
Created16.07.2015 22:45


Martin Fabik (Hungar) 16.07.2015 22:59
Hi.

I tried outside IC with implement control. In cab I can control everything about attached implements. But if I'm outside of vehicle and start event which control lowering of implement. Then implement (in my case cultivator) play lower animation, but main vehicle won't move with attacher joint hydraulic (variables jointDesc.rotationNode2 and jointDesc.rotationNode). I tried to set rotation over this two variables but I can't see any visual effect. Anyway if I enter main vehicle (tractor) attacher joit hydraulic start to move, but I need start this movement outside the vehicle without entering. Is there any possible way how to set rotation over rotation nodes or any function to do this.

Functions I tried:

self:setJointMoveDown(implement.jointDescIndex, moveDown, true);
self:setAIImplementsMoveDown(moveDown, true);
self.lowerImplementByJointIndex(self, index, moveDown);

but everything ends the same way - no movement on main vehicle.

Code to change implement state:

for _, index in pairs(self.LIC.joints.back) do
local implementIndex = self:getImplementIndexByJointDescIndex(index);
local implement = self.attachedImplements[implementIndex];
if implement ~= nil then
local object = implement.object;
if object ~= nil then
if object.isPickupLowered~= nil and object.setPickupState~= nil then
object.setPickupState(object, not object.isPickupLowered);
else
local moveDown = not object:isLowered();
if object.getToggledFoldMiddleDirection~= nil then
local direction = object.getToggledFoldMiddleDirection(object);
end;

if implement.object.attacherJoint.needsLowering and implement.object.aiNeedsLowering then
self:setJointMoveDown(implement.jointDescIndex, moveDown, true);
end;

-- self:setAIImplementsMoveDown(false, true);
-- self.lowerImplementByJointIndex(self, index, moveDown);
-- if object.attacherJoint.allowsLowering and object.attacherVehicle.attacherJoints[index].allowsLowering then
-- object.attacherVehicle:setJointMoveDown(index, moveDown, false);
-- end;
end;
end;
end;
end;

Cheers,
Martin Fabík.

Emil Drefers (giants.edrefers) 17.07.2015 08:52
Hi,

well, I did not look at your code ;)

The original code which moves/changes the attacherJoint is in the vehicle.lua script:
http://ls-mods.de/scriptDocumentation.php?lua_file=vehicles/Vehicle
starting at line 2607

The problem is that the joint gets only updated if the vehicle isActive, which is only true if a player sits in the vehicle.

So, you have two possibilities now ...

a) try to activate the vehicle. This could already be the case if you use the ManualIgnition mod. But there are other ways to achieve this too (e.g. have a look for the variable forceIsActive and set it to true for a certain amount of time, the time needed to lower the tool)

b) copy the default code and use it in your script

Anyhow, good luck and cheers
Emil


Martin Fabik (Hungar) 17.07.2015 13:05
Hi,

thanks a lot for response. I didn't realize that vehicle must be active for this. I tried to active vehicle and it works, but I think that the ManualIgnition mod would be better choice.

Cheers,
Martin Fabík


Note: Log in to post. Create a new account here.