Jump to content

Wings and how to directly control them


Recommended Posts

Hey people.

First, sorry for the wing vocabulary, I'm not entirely sure I'm using it right.

I'd like to understand if it is possible to take control, through the API, of the angle of a controllable air surface without using the Flight control Pitch / Yaw / Roll inputs.
Is there a way to directly set an angle on any controllable flap/wing ?

I see that I can fetch the result of the drag and lift vectors (liftForce & dragForce of ModuleLiftingSurface) which is great, but can't see any input. (It is not the deploy feature I think)

I'm also slightly confused between the class ModuleLiftingSurface, ModuleControlSurface and ModuleAeroSurface and not sure if one of those three allows to do what I'm looking for.

Anyone is familiar with what I'm looking for ?

 

Link to comment
Share on other sites

  • 2 weeks later...

I would think the AOA of the wing would be what KSP computes each frame based on the vessel orientation - if your trying to move the flaps I think you want to target the control surface.

Link to comment
Share on other sites

  • 2 weeks later...

Thanks wasml. Sorry, I didn't see your notification. I couldn't get access to the control surface when using the part. It was not accessible from outside.

So, I think I found out and it's much more indirect than I thought.

I have to implement a new class inheriting from ModuleControlSurface.

By doing so, you can overwrite the method CtrlSurfaceUpdate(Vector3 velocity) inside which you have access to the vector ctrlSurface.localRotation

At the game loading, you have to replace all Parts that implement ModuleControlSurface so that they implement this new class instead and now I can now change the angle of the wings at will with my own laws.

So indirect, but finally found out.

Link to comment
Share on other sites

Ah, damnit. Despite the wing being at the right angle. It seems that the aero forces are not following / not taking in account the modified angle. I wonder what I forgot. Do you know if I need to reimplement something so that the angle is taken into consideration ? I thought the rotation would suffice
aero.png

Link to comment
Share on other sites

Ok, finally found how to udpate the aero forces:

the property "deflection" needs to be updated too as well as forcing aero to recompute by setting alwaysRecomputeLift = true;

ctrlSurface.localRotation only affects the visuals of the part

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