Jump to content

Prograde (and other) vectors


Recommended Posts

I've finally started work on a HUD, and I've got everything I need except for one thing. I can't for the life of me get any useful information about where the prograde vector (or any other navball marker) is. I've been using the FlightUIController's NavBall as the source for pitch and roll, which come out of a Quaternion called relativeGymbal. I can just extract the Euler angles to get pitch, roll, and yaw. Works great. Then there are Transforms for progradeVector, progradeWaypoint, and target. Unfortunately I can't seem to do anything with them. I would think I would do

 progradeTransform.rotation

and be able to use that directly, or use something like

Quaternion.Angle(vesselRot, ball.progradeVector.rotation)

to get at least an angle between them, but I can't seem to work out a combination that provides useful data. Ideally, I want to get the pitch and yaw (x and y Euler angles) for the progradeVector. Does anyone have any recommendations? Thanks for your help.

Link to comment
Share on other sites

  • 2 weeks later...

Don't really understand Quaternions so I can't give you help on them.

In the KSP documentation you can find the following variables:

public static Vector3d ship_tgtVelocity;

Vector3 vesselTargetDelta;

Vector3 vesselTargetDirection;

Transform vesselTargetTransform;

And maybe can be use to get the prograde an therefore retrograde vector from Vector3d ship_obtVelocity.

You might get the data you need out of these things (Possibly in combination with some part.transform.InverseTransformDirection(Vector3d)) I'm certainly not an expert on this so this might not make much sense in the end but this is where i would start looking for an alternative way.

Link to comment
Share on other sites

Ideally, I want to get the pitch and yaw (x and y Euler angles) for the progradeVector.

Relative to what? The planet/navball orientation?

You could try progradeTransform.localEulerAngles - if squad have made those transforms children of the GameObject that the navball is attached to then they should give you the angles relative to the navball orientation (or localRotation if you want the quaternion).

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