So, almost every "set" function in class CarController is not working
- SetSteering
- SetThrust
Only things that seems to be working are
- ShiftUp/ShiftDown and ShiftTo
So, almost every "set" function in class CarController is not working
Only things that seems to be working are
HumanCommandVehicle vehCommand = GetGame().GetPlayer().GetCommand_Vehicle(); if ( vehCommand ) { Transport trans = vehCommand.GetTransport(); if ( trans ) { CarScript drivingVehicle; if ( Class.CastTo( drivingVehicle, trans ) ) { CarController tctrl = drivingVehicle.GetController(); tctrl.SetSteering(0.5); tctrl.SetThrust(0.5, 0, 1); Print("GetThrust " + tctrl.GetThrust()); Print("GetSteering " + tctrl.GetSteering()); } } }
Hello Camino.
Can you please describe what are you trying to achieve / what the code you have presented should do?
Regards,
Geez
Hello, i am trying to force the vehicle to move forward and steer itself without driver
Hello Camino.
The code you have provided should work. Is it possible that you are calling this code only on the client? As this should be called on the server in order for it to work correctly.
Regards,
Geez
Some more information to help solve this issue.
It's not working when called on a Server in MP either. Both with a human player (INSTANCETYPE_SERVER), an AI player (INSTANCETYPE_AI_SERVER) or no player in the seat.
Most likely not relevant but the AI was linked to the seat via Transport::CrewGetIn and Human::LinkToLocalSpaceOf, not from Human::StartCommand_Vehicle. Shouldn't be relevant because the two other scenarios did not work.
Best guess, the code is still updating the thrust and other variables just before the simulation starts overwriting the changes we make using the CarController.
An idea on how this could be solved is just to create and then expose a script method which is called after car inputs have been resolved in engine. This can then be used to override the inputs if a modder desires to do so.
SetSteering and SetThrust. Don't work dayz 1.08 27 July 2020
Tried both from server and client.
`
Man t_Man; if (!t_Man) { array<Man> t_ArrMan = new array<Man>; GetGame().GetPlayers(t_ArrMan); if (t_ArrMan && t_ArrMan.Count() > 0) { t_Man = t_ArrMan.Get(0); }; }; if (!t_Man) { return; }; Print("m:"+t_Man); PlayerBase t_Player = PlayerBase.Cast(t_Man); if (!t_Player) {return;}; Car t_Car = Car.Cast(t_Player.GetCommand_Vehicle().GetTransport()); CarController t_CC = Car.Cast(t_Player.GetCommand_Vehicle().GetTransport()).GetController(); Print("t:" + t_Player.GetCommand_Vehicle()); Print("t:" + t_Player.GetCommand_Vehicle().GetTransport()); Print("t:" + Car.Cast(t_Player.GetCommand_Vehicle().GetTransport()).GetController()); Print("t:" + Car.Cast(t_Player.GetCommand_Vehicle().GetTransport()).GetController().GetSteering()); t_CC.SetThrust(0,0,0); t_CC.SetSteering(-1,false); //t_CC.ShiftUp();
`
ShiftUp() worked as intended
Please fix those methods above. In my usecase of bicycle I need set thrust when diver get in automatically to have more realistic entering to bicycle a instantly move. Right now is great that at leas gearbox controller is working, so I can automatically set gear to FIRST while entering to bicycle.
Hello everyone.
The original issue described in the report is solved for the next experimental update
New methods have been exposed within 'Car' to allow control of the car while there is no driver. This also extends to allowing non-player 'Human' based drivers, as long as the 'Human' entity is in 'HumanCommandScript' and not 'HumanCommandVehicle'.
As for the thing mentioned by @Hunterz that will not be solved with this update.