Jump to content

Creating a mod


Recommended Posts

How do I make an autopilot mod?  I want to be able to find out what the orientation of the ship is with kerbin, and the orbit parameters.

Edited by ianyikos
Adding extra information
Link to comment
Share on other sites

  • 4 weeks later...

I have no idea how to measure the error in orientation, but the control algorithm for my previous autopilot mod depended on the angular velocity.  The desired angular velocity about whichever axis depended on the error with respect to that axis, and I varied the angular acceleration to maintain the desired angular velocity, so as you're rotating it smoothly just decelerates on the desired direction, and if the ship is rotating like with its orbit then it just maintains the angular velocity.  But I don't know how to use quaternions to accomplish that.  I just used the down direction and right direction and forward direction to compare to the orientation.  And the orbit direction.  But I could never figure out how to correct the error like the game itself does.  Because it only seems to care about the relative rotation or something, but mine could only depend on the front, down, side directions.  And it doesn't seem to care about the roll axis, only yaw and pitch.  But that makes it even more confusing for me because I couldn't figure out how to find the desired direction in absolute coordinates, unless it was the orbit direction or something.  But the error depends on the angles relative to the forward direction.

Edited by ianyikos
Link to comment
Share on other sites

var direction = (this.vessel.getworldpos3d() - worldpos where you want to travel to)

this.vessel.rootPart.addforce(direction * speed you want to add to vessel)

The above should at the very least will show you what in the API you should be looking for .... if you don't know how to find the above in the KSP API then you are not ready to make your mod as you'll need some knowledge of the KSP API and Unity in order to get it to work

I assume you know how to write programs/scripts in C# .... if not then this will be another hurdle that you must overcome to make your mod

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