I've looked around at different methods for getting and settings flight controls, but none of them have worked, except for the throttle which worked with the following code.
FlightInputHandler.state.mainThrottle = 1.0f;
I'm starting to wonder if it's due to any other addons as the throttle works (only using the code above). The code below is what I've currently got, but it doesn't work.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
namespace TestAdd
{
[KSPAddon(KSPAddon.Startup.Flight, false)]
public class TestAdd : MonoBehaviour
{
public void OnStart()
{
FlightGlobals.ActiveVessel.OnFlyByWire += MyControlSystem;
}
public void MyControlSystem(FlightCtrlState state)
{
state.roll = 1f;
state.pitch = -1f;
state.mainThrottle= 1f;
}
public void OnDestroy()
{
FlightGlobals.ActiveVessel.OnFlyByWire -= MyControlSystem;
}
public void Update() //This is another method i've tried
{
FlightInputHandler.state.roll = 1.0f;
FlightInputHandler.state.pitch= -1.0f;
}
}
}