Comments and answers for "How can I find direction with known 2 projection angles on xz and yz planes?"
http://answers.unity.com/questions/1513987/how-can-i-find-direction-with-known-2-projection-a.html
The latest comments and answers for the question "How can I find direction with known 2 projection angles on xz and yz planes?"Comment by Scribe on Scribe's answer
http://answers.unity.com/comments/1516257/view.html
For anyone looking at this question in future, I'm pretty sure the use of the Tan function here is incorrect and should have been using Sin instead.
The reason I say that is because my interpretation of the information we have here is we know:
1. The angle
2. The length of the hypotenuse (the longest side) which is the length of whatever vector we are rotating, in this case it's `1`
And we want to find, the length of the side `opposite` the angle. The remaining side of the triangle is usually called the `adjacent`.
----------
Since we have that `Tan(angle) = opposite / adjacent` I don't think we can use it, as we don't know the adjacent side length.
Instead we can use `Sin(angle) = opposite / hypotenuse` since here the `hypotenuse` is always going to be of length 1, this is the same as `Sin(angle) = opposite`.
----------
I think the arguments are also in the wrong order based on the image, as the angle `A` should relate to the x-axis and angle `B` to the y-axis.
The final answer for most users cases would look more like:
Vector3 u = transform.rotation * new Vector3 (Mathf.Sin(A * Mathf.Deg2Rad), Mathf.Sin(B * Mathf.Deg2Rad), 1);
----------
I'm glad you found an answer that works for you JeyP4, just explaining for the next person!Sat, 09 Jun 2018 08:53:49 GMTScribeAnswer by JeyP4
http://answers.unity.com/answers/1514600/view.html
I find below code working for raycasting direction :)
Vector3 u = new Vector3 (-Mathf.Tan (B * Mathf.Deg2Rad), Mathf.Tan (A * Mathf.Deg2Rad), 1);
u= Quaternion.Euler(transform.eulerAngles.x, transform.eulerAngles.y, transform.eulerAngles.z) * u;
But anyways many thanx for considering my question to answer.Tue, 05 Jun 2018 11:41:00 GMTJeyP4Answer by Scribe
http://answers.unity.com/answers/1514338/view.html
The easiest way looks to be projecting the vector calculated from A onto the X axis and adding to the vector calculated for B (or the same technique the other way around)
Vector3 aVec = ...;
Vector3 bVec = ...;
Vector3.Project(aVec, transform.right)+bVec;Mon, 04 Jun 2018 20:53:37 GMTScribeComment by JeyP4
http://answers.unity.com/comments/1513989/view.html
**just FYI, as trigonometry says B != C**
![alt text][1]
[1]: /storage/temp/118217-vector3-2.jpgSun, 03 Jun 2018 23:11:43 GMTJeyP4