Sign in to follow this  
claypigeon

Attitude Control for additional parts

Recommended Posts

Hi folks. 1st, apologies if this is old ground. My google-fu is weak.

I'm interested in adding attitude control to parts that are not the main capsule. In particular, I thinking about adding attitude control to these parts, which right now are marked as "struts". I figure that writing a plugin is the way to go, but want to make sure that it's possible before I burn the time learning how to write a plugin.

For the curious, my goal is to make it possible to recreate something like the Apollo mission, where a craft detaches and lands on the moon while the "mothership" remains in orbit. I've already done something like this, but my craft has to rely on RCS for turning, which is an imperfect solution. I'm hoping to create something better.

Share this post


Link to post
Share on other sites

Until docking is implemented, a true Apollo style mission is nigh impossible.

MechJeb is really good for attitude control. It's Smart A.S.S. module has one click buttons for orienting yourself along the major 3D axis'.

Cheers!

Capt'n Skunky

KSP Community Manager

Share this post


Link to post
Share on other sites

Redocking is definitely something for another day. At the moment, I'm exploring the possibilities of being able to detach from the "mothership" and go elsewhere. If you want to "redock", you can EVA and sling yourself across the void. :)

MechJeb offers almost everything I need. The problem is that MechJeb doesn't have it's own attitude control, per say. It relies on whatever is available on the ship. So if the ship doesn't have any built-in attitude control, it just sits there (even though MechJeb lets you "pilot" it). SmartASS buttons won't do anything, because there's nothing on the ship to work with.

That's why the example I gave above relied on RCS and vectoring engines: without them the ship couldn't turn, even with MechJeb. The problem that trying to steer with only RCS and engine exhaust is very difficult, so I'm interested in developing a plugin to make it easier (ie. giving a part it's own attitude control).

Share this post


Link to post
Share on other sites

Just tried it. A normal SAS does not work.

I think the trick is I need some way (probably by plugin) for the engine to interpret that rotPower and linPower directives as it does for a regular pod.

Share this post


Link to post
Share on other sites

ever tried remotetech? you can make controllable debris with attitute control with the remotetechSAS, dont know maybe it even works with mechjeb.

Share this post


Link to post
Share on other sites

Hey, check out how ORDA makes it's stuff move. It 'invents' forces.

I'll go look it up and report back.

EDIT: Ok, so all the ORDA pods and ORDA ASAS use the ORDA_control_pm module and that sets up a torqeFactor of at least 10 if no other torqe device exists (such as that on vanilla pods). He sets this in the OnStart() method, and then references it in the OnFixedUpdate() method with the following to apply the torque

// apply torque

float pitch = FlightInputHandler.state.pitch;

float roll = FlightInputHandler.state.roll;

float yaw = FlightInputHandler.state.yaw;

Vector3 torque = new Vector3 (-pitch, -roll, -yaw) * torqueFactor;

vessel.rigidbody.AddRelativeTorque (torque);

So grab the input and make a vector and multiply it by your torqueFactor, then apply it to the vessel as a rigid body (from the center of mass I'm guessing).

DISCLAIMER: I've never modded KSP or used Unity. I'm just guessing based on how code usually works.

Edited by fusty

Share this post


Link to post
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.

Sign in to follow this