Jump to content

Hydrawx

Members
  • Posts

    6
  • Joined

  • Last visited

Everything posted by Hydrawx

  1. Thank you for your answer! I thought C# only implicitly copied the reference to that object. Also the wheelThrottleTrim and pitchTrim do behave like expected, but if accessing the ctrlState directly through the vessel works for you, then I will try this as well later on. Edit: tried it, still doesn't work. As I thought, it's not the reference to the object that is the problem here, because I can observe it through a debugger and I can clearly see that the right object is modified. However, there is still something you're doing right which I am not. Does your code also handle the steering of the wheels? If so, could you show me the part of your code where you control the wheels? It would be greatly appreciated. Edit 2: Somehow wheelSteerTrim doesn't get registered and wheelThrottleTrim does: I made sure to use wheels that are steerable and I also checked if the steering was enabled for those wheels.
  2. Hi, I'm trying to control my rover. I'm able to make it drive straight forward by modifying the wheelThrottleTrim and pitchTrim fields from Vessel.ctrlState. However, I couldn't get the rover to steer by modifying the wheelSteerTrim and yawTrim fields. void Update() { FlightCtrlState vesselCtrl = FlightGlobals.ActiveVessel.ctrlState; vesselCtrl.wheelThrottleTrim = this.Drive; vesselCtrl.pitchTrim = this.Drive; vesselCtrl.wheelSteerTrim = -1f*this.Steer; vesselCtrl.yawTrim = this.Steer; } The Steer property is modified by some button listeners, and gets the value -1f if steering left and 1f if steering right. The sign of wheelSteerTrim field is inverted, because the steer direction of my wheels are also set to inverted (this is the way it would be if I gave user input and observed the ctrlState object through a debugger). Also, here's a picture of a the rover I'm using to test my mod: So the problem is: I can't steer the wheels through an instance of the FlightCtrlState class. Am I missing something here?
  3. I'd like to add that you have to use the trim fields to override the controls for the actuators. The regular fields only seem to indicate the user input. See sarbian's post.
×
×
  • Create New...