Jump to content

[Workaround] How to convert angle to unit vector (angled stack nodes)


CaptainKipard

Recommended Posts

Thanks. That's good reference but it's only for those angles.

I've been trying to google, but I'm getting confused results. The KSP wiki says that a 45 degree angle angle should be written as [1,1], but then people say I should be using cos and sin on the angle which doesn't give those same results.

Link to comment
Share on other sites

You can't do arcsin or arccos with an angle, it's used for finding the angle of a normalized vector (magnitude=1). This graphic may help:

asinacosatan.png

If sin(alpha) = O/H, then alpha = arcsin(O/H) where A is X and O is Y (or the other way around if you wish) and H is the resultant vector

The former can be used to easily find O or H, but the latter is used almost exclusively to find alpha (the angle you're using as a reference point)

Edited by OrbitusII
Why did that graphic use alpha instead of theta???
Link to comment
Share on other sites

The KSP wiki says that a 45 degree angle angle should be written as [1,1], but then people say I should be using cos and sin on the angle which doesn't give those same results.

i think the magnitude of the x and y vectors for the nodes do not matter. As long as it gets 45 degrees, it could care less about the magnitude of the vectors.

2,2

1,1

0.5,0.5

will all net you 45 degrees

Link to comment
Share on other sites

:mad: I'm even more confused now that I was before.......

basically they're saying

cos(6.763)=X

sin(6.763)=Y (or Z in your case I think)

just make sure calculator knows 6.763 is degrees, not radians

Edited by nli2work
Link to comment
Share on other sites

Picture again:

asinacosatan.png

If you want the attachment axis to be 6.763 degrees off of +X, just take the sine of 6.763 for the Y-axis (O in the picture) and the cosine of 6.763 for the X-axis (A in the picture). Make sure your calculator is using degrees and not radians because then you'll end up with a totally different result.

This works because when using a Hypotenuse length of 1, the equation sin(alpha) = Y/H simplifies down to sin(alpha) = Y, giving you the Y-component of the triangle. The same can be done for cosine and the X-component of the triangle. These components can then be combined to create the vector (X,Y), which can be represented by the Hypotenuse of the triangle.

If you haven't taken any trigonometry courses (Pre-Calc, Calculus) I would strongly recommend it. People might say that math is useless, but they're wrong.

Edited by OrbitusII
Link to comment
Share on other sites

Ok I think I can make it work now.

If you haven't taken any trigonometry courses (Pre-Calc, Calculus) I would strongly recommend it. People might say that math is useless, but they're wrong.

I did take calculus a looong time ago. I failed it, partly because the teacher didn't explain it in a way that's easy to understand or practical. If you know of any sources (preferably video) that explain trigonometry and calculus like to a moron, then I'd like to look at it.

Link to comment
Share on other sites

I don't know of any resources besides Khan Academy off the top of my head, but KA is free and supposedly quite good. I can't advocate for it myself since I took AP Calc with a phenomenal teacher (the son of Donald Knuth, if anyone knows who that is) and I'm innately wired for math, but it's better than nothing.

Link to The Trigonometry Page

Link to comment
Share on other sites

Did the NODE{} config calls get fixed?

Herp, I should check my parts which use NODE{} and see if they're the right size now, brb.

[Edit] Put empties where you want (and pointed where you want) the connection nodes, then use NODE{} in the config to use those empties as your attach nodes

Example pic

MLyjb2e.png

[Edit3] Make sure your transform names are correct though (sorry opened the wrong model for that config). In game screen of part using NODE{}

Edited by NoMrBond
Link to comment
Share on other sites

Did the NODE{} config calls get fixed?

Herp, I should check my parts which use NODE{} and see if they're the right size now, brb.

[Edit] Put empties where you want (and pointed where you want) the connection nodes, then use NODE{} in the config to use those empties as your attach nodes

Example pic

http://i.imgur.com/MLyjb2e.png

[Edit3] Make sure your transform names are correct though (sorry opened the wrong model for that config). In game screen of part using NODE{}

I vaguely remember something about these, but never see any configs using it... whats the difference between Hinge and fixed joints?

Link to comment
Share on other sites

Wow. I wish I had known about this weeks ago. It would save so much effort. I'll try it. I guess I should be using fixed_joint. What's the correct orientation in Unity.

Sorry about that, I couldn't remember if it had been fixed or not (all NODE sizes used to come out in-game as size=0 (0.625) which was badddd news for lots of things especially after the 0.23.5/ARM joint strength based on size/size, and also for FAR where wrong size/size joints cause trouble), this prodded me to recheck parts I had made using empties/transforms/NODE{}

I vaguely remember something about these, but never see any configs using it... whats the difference between Hinge and fixed joints?

Fixed_joint for your stack nodes and hinge_joint for other (radial etc) joints, some restrictions though (last two defined joints need to be your stack_node/fixed_joint's)

Edited by NoMrBond
Link to comment
Share on other sites

Just tested. Sizes look right. Orientation must be +Z.

This makes things so much easier.

This deserves to be in the dev links thread. What's the terminology for this? All I can think of is that it's a "node node"

Edited by Cpt. Kipard
+Z not -Z
Link to comment
Share on other sites

I would be careful about using the NODE{} system, it has never worked as advertised since it was implemented. The original developer topic that introduced it has (I'm assuming) been moved into the moderator archive, and most of the experimentation people did was in that thread. There is this post that goes over a few of the rules people discovered about the system though.

Link to comment
Share on other sites

The fixes to the NODE{} system certainly weren't widely advertised, and the exact nature of what was fixed wasn't laid out in the patch notes

It would be nice to have something official from one of the developers laying out the specifics

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