Comments and answers for "Finding Distance between Angles and Points"
http://answers.unity.com/questions/845743/finding-distance-between-angles-and-points.html
The latest comments and answers for the question "Finding Distance between Angles and Points"Comment by boddole on boddole's answer
http://answers.unity.com/comments/846557/view.html
@SparkyAllMighty :
->After going over some trigonometry I'm using (with an arbitrary angle of 30): cos(30) = 1000/hypotenuse. It seems to be giving correct values. Am I using the correct formula at this point?Thu, 04 Dec 2014 03:49:49 GMTboddoleComment by boddole on boddole's answer
http://answers.unity.com/comments/846556/view.html
@Eck:
->I'll try explaning another way:
I'm looking for a ray of any angle to return a point that contains my specified Z value (so if the ray is 1 degree, it should return a point value of: (some value, some value, 1000), if the ray is 75 degrees, it would again be: (some value, some value, 1000).
Using your and Sparky's posts (using an arbitrary angle of 30) I'm doing: cos(30) = 1000/hypotenuse (which seems to give good values).
As a side note, these points are only calculated 1 time and converted into a trigger mesh which is used for the duration of the scene.Thu, 04 Dec 2014 03:48:12 GMTboddoleAnswer by Eck
http://answers.unity.com/answers/846119/view.html
Like others, I'm not sure what you're asking either. Let me know if this idea is correct. Are you asking for where the rays will hit on a flat plane that is perpendicular to a ray straight out from your avatar? If so, that's just trigonometry.
The length of the 0 ray (your adjacent side ) is going to be your desired z distance (1000 you said). Let's say your sweep angle is 30 degrees. The length of your the opposite side is going to be
oppositeSide = tan(30)*1000; //= 577.35 (roughly)
You've got some unit vectors tied to your game object that are useful.
leftPoint = transform.forward * 1000 - transform.right * oppositeSide + transform.position
rightPoint = transform.forward * 1000 + transform.right * oppositeSide + transform.position
Instead of calculating this every frame, you could make some empty child game objects of your avatar, set their relative position on start, and then as the model moves/rotates it will update the positions update automagically and you can read their position as necessary. Just be aware that if you scale your avatar with a growth effect, that would also change your distance.
Edit: After seeing SparkyAllMighty's answer, using the hypotenuse might be better. I'm not sure which would be more efficient.
hypotenuse = 1000f / cos(30); //= 866.03 (roughly)
And then find the final resting point by getting your two rays' unit vector and multiplying by the hypotenuse. If you already have the unit vectors, this is probably faster.Wed, 03 Dec 2014 15:07:41 GMTEckAnswer by SparkyAllMighty
http://answers.unity.com/answers/846087/view.html
You want to use trigonometry. Cos, Tan, Sin and the like, which should be in the math helper functions. I've not installed Unity yet so can't be sure.
You know the distance of one side (1000) and presumably you know the angle you are raycasting to. That should give you enough to work out the distance to the point you want.
![alt text][1]
[1]: /storage/temp/36357-trig.png
Replace A with your angle and you should be able to use trig to find out XWed, 03 Dec 2014 14:33:26 GMTSparkyAllMightyComment by boddole
http://answers.unity.com/comments/845939/view.html
@robertbu:
Not sure what you are asking
-> Basically, I would like to find the point along a ray at a set amount of forward distance regardless of the angle of the ray (where a point would be along a ray at the specific world distance, not ray forward distance). Maybe that makes more sense?
You can then use Plane.Raycast() to find the hit point
-> I'll take a look, thanks.
@OboShape:
for finding the the point along the arc, is it from a fixed origin, like a sweep?
-> What is going on is that 4 Vector3s are taken as input (the anchor points of the near clip plane, a direction is determined for each point, the ray (which I think uses a normalized vector for its direction parameter) and then a Vector3 point is taken from a float distance moving along the ray. The distance is just applied from the direction vector * the distance float value.
All that brown line shows is how "crooked" the mesh becomes when built, since steeper angles don't go as far as the shallow angles.Wed, 03 Dec 2014 10:46:25 GMTboddoleComment by robertbu
http://answers.unity.com/comments/845838/view.html
Not sure what you are asking. If you are looking for the position where a Ray intersects a plane, then use [Unity's mathematical Plane class.][1] You can then use Plane.Raycast() to find the hit point. This is a mathematical class, so no mesh is involved. You may also want to take a look at the [Math3d][2] class in the Unity Wiki.
[1]: http://docs.unity3d.com/ScriptReference/Plane.html
[2]: http://wiki.unity3d.com/index.php/3d_Math_functionsWed, 03 Dec 2014 07:48:34 GMTrobertbuComment by OboShape
http://answers.unity.com/comments/845834/view.html
Morning,
for finding the the point along the arc, is it from a fixed origin, like a sweep?
is the vector being normalised, and then multiplied by the distance to get end point?
not at home PC at present, just thinking out loud :)Wed, 03 Dec 2014 07:43:15 GMTOboShape