Jump to content

Get relative axes of a ship part


Recommended Posts

I'm trying to make a simple mod to figure out how everything works, as it were - I want to draw a line from the root part for gravity, thrust, and the three relative axes of the root part (forward, up, and right).

Currently, I'm using the following. The ForwardAxis gets a constant vector which reliably points out the side of the root part; the other two axes do all sort of crazy wonkiness and don't actually stay fixed relative to the part in question.

Vector3 ForwardAxis = FlightGlobals.ActiveVessel.rootPart.transform.forward;
Vector3 UpAxis = FlightGlobals.ActiveVessel.rootPart.transform.up;
Vector3 RightAxis = FlightGlobals.ActiveVessel.rootPart.transform.right;

Why do UpAxis and RightAxis not work the way I would expect them to, and is there a way to get the part's relative up and right axes?

Link to comment
Share on other sites

Having fiddled around further, I realized what I was doing wrong and fixed it. However, I can't seem to figure out how to get the current target; FlightGlobals.activeTarget seems to just be the root part no matter what I do.

Link to comment
Share on other sites

  • 2 weeks later...
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...