Jump to content

can't change custom_axes from code (Solved)


Recommended Posts

I tried to modify the custom_axes values of the control state in multiple ways, but I couldn't find a way that applies it in game.

Things I tried:

 FlightGlobals.ActiveVessel.ctrlState.custom_axes[0] = 0.33f;

With OnFlyByWire attached to FlightGlobals.ActiveVessel.OnFlyByWire:

OnFlyByWire(FlightCtrlState state){

state.custom_axes[0] = 0.33f;

}

and also

FlightCtrlState state = new FlightCtrlState(new float[4]{ 0.2f, 0.2f, 0.2f, 0.2f});
FlightGlobals.ActiveVessel.SetControlState(state);

sadly, none of these work.

Is there another way to do this?

 

edit:

I found a workaround for this:

AxisGroupsModule axisModule = FlightGlobals.ActiveVessel.FindVesselModuleImplementing<AxisGroupsModule>();
axisModule.SetAxisGroup(KSPAxisGroup.Custom01, value1);
axisModule.SetAxisGroup(KSPAxisGroup.Custom02, value2);
axisModule.SetAxisGroup(KSPAxisGroup.Custom03, value3);
axisModule.SetAxisGroup(KSPAxisGroup.Custom04, value4);

(value1 to value2 are floats containing the axis value)

If someone knows a better way, please notify me :)

Edited by X52
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...