Jump to content

How Does the Game Treat Pitch, Yaw, and Roll Commands?


Recommended Posts

I'm working on my first full plugin and I'm also kind of new to the forums. Please try to be polite if I did something wrong.

I want to basically tell the computer to pitch up or down, even if the user isn't pressing the W or S keys. My goal is not only for pitching but for other things as well. How can I simulate the pressing of the WASD keys or any keys for that matter?

Thanks for your help!

Link to comment
Share on other sites

You can modify the control state of the craft by subscribing to the vessel's OnFlyByWireEvent:

public void OnStart ()
{
FlightGlobals.ActiveVessel.OnFlyByWire += MyControlSystem;
}

public void MyControlSystem(FlightCtrlState state)
{
// Do things with the state here.
}

public void OnDestroy()
{
FlightGlobals.ActiveVessel.OnFlyByWire -= MyControlSystem;
}

Link to comment
Share on other sites

You can modify the control state of the craft by subscribing to the vessel's OnFlyByWireEvent:

public void OnStart ()
{
FlightGlobals.ActiveVessel.OnFlyByWire += MyControlSystem;
}

public void MyControlSystem(FlightCtrlState state)
{
// Do things with the state here.
}

public void OnDestroy()
{
FlightGlobals.ActiveVessel.OnFlyByWire -= MyControlSystem;
}

That's exactly what I wanted, thanks!
Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

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...