Jump to content

Get-Vector script ?


Recommended Posts

Its easy enough to find it manually. Set up your part as you want in your software, or in Unity. Then create a new object and place it where you would want the node. Then find the location transform for that object (in other words, the coordinates for its location); it will be the offset values for your node from the origin of your part (make sure you part is situated over the scene origin properly)

Link to comment
Share on other sites

thanks both for reply, I just found the script it earlier in the deprecated KSP SDK available on official wiki.

@Tiberion: it sounds easy in your mind I guess with your experience, but without a bit of practice and knowledge, it doesn't looks like so easy reading you :). I'm just begin to make parts and I have to make my way in, so I'll be happy to discover as much methods as possible to get the one which fit me the best.

Link to comment
Share on other sites

Well, its simple once you understand how objects exist within the 3d scene you work in. Each "object" be it a mesh, a collider, or just an "empty" abstract GameObject placed in Unity has its own set of coordinates that tells you where it is with relation to the center of the scene (which is 0, 0, 0)

So if you make a simple cylinder for a fuel tank, and leave it at the scene origin, its coordinates are also 0, 0, 0. To alter this, you can transform "Objects" by moving them, scaling, them, or rotating them. This is different from actually editing the geometry of a mesh in "edit mode" or whatever - you're just applying modifications to the object and not its underlying parts, and you can go it to any type of object (even if scaling an empty abstract object to 2x scale doesn't seem to have any value, it actually can if you add other objects to it as "children" as they can inherit transforms from their parents, but thats a story for another day.)

So lets say you make that cylinder just the right size, but you don't know how "tall" it is and thus don't know where to put the top and bottom nodes would be, as coordinates.

Most 3d programs have a function where you could select the top face or a vertex on the cylinder itself and find the coordinate that way (In Blender, you go into Edit mode, hit N to open the property panel and select the top face, and the coordinate is displayed.

Or, you can use the method I desrcibed in my last post, which is a little more flexible, because you might not always have a face or a vertex in the exact spot you would want your node. So here, you create another object (it can be a tiny cube in your 3d program, or any sort of object in Unity) and move the object so that its origin point is exactly where you want the node to be. Then the coordinate of your new object will match the desired coordinate of your node on the original object.

Lets say you move your 2nd object so that it sits right where the node on top of your cylinder would be, and when you check its coordinates, it has 2.25 as its vertical coordinate (and if you moved neither off of the origin on the other axies, they should both be 0) - Thus the coordinates of your node would be 0, 2.25, 0 (and if your cylinder is symmetric top vs bottom, the bottom node coordinate would be 0, -2.25, 0.

Since its a fuel tank, you want it to align vertically, which means the 'vector' half of the node would be 0, 1, 0, like so:

node_stack_top = 0, 2.25, 0, 0, 1, 0

node_stack_bottom = 0, -2.25, 0, 0, 1, 0

With the blue part being the coordinate, and the red part being the vector.

So if you have a weird shaped object, the node might be in a random spot on all three axis, with a coordinate of 1.375, 2.375, 0.755 which would be difficult to "eyeball" - but moving the object to that location is easy, and you can plug the coordinate right into a node.

Also note, you can round down if you get really long decimals in the coordinate, 3 or 4 digits is generally as specific as you can be.

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