Comments and answers for "change angle towards direction"
http://answers.unity.com/questions/1146068/change-angle-towards-direction.html
The latest comments and answers for the question "change angle towards direction"Comment by Eno-Khaon on Eno-Khaon's comment
http://answers.unity.com/comments/1146342/view.html
I'm not really sure what you mean. What is "it" that is zero?Tue, 23 Feb 2016 19:14:44 GMTEno-KhaonComment by najikadri on najikadri's answer
http://answers.unity.com/comments/1146318/view.html
I did that and it gave me zero ! why?Tue, 23 Feb 2016 18:11:50 GMTnajikadriAnswer by Eno-Khaon
http://answers.unity.com/answers/1146117/view.html
Well, you have the direction vector of the bullet prior to bouncing off the surface, as well as the calculated new vector after it's deflected.
Being a little lazy and taking a note from this [older question][1], you should be able to generate a Quaternion rotation by doing something like this:
Quaternion angleAdjustment = Quaternion.FromToRotation(currentDirection, reflectedDirection);
transform.rotation = angleAdjustment * transform.rotation;
Quaternion multiplication order always throws me off, so I apologize if I got the final line backwards; Non-commutative math is never pleasant to work through.
Anyway, with both of the directions in mind, the vectors can be run through a FromToRotation to calculate how to reach the destination vector from the current vector. Then, that value can be multiplied with the current rotation to rotate to the new orientation.
Edit: I understand if it doesn't work out for you, since you already mentioned you'd given FromToRotation a try, but I'm simply offering my perspective on it in case anything may have been overlooked.
[1]: http://answers.unity3d.com/questions/395033/quaternionfromtorotation-misunderstanding.htmlTue, 23 Feb 2016 10:48:31 GMTEno-Khaon