Quantcast
Channel: Questions in topic: "quaternion.slerp"
Viewing all articles
Browse latest Browse all 133

quaternion and interpolation: no reaction?

$
0
0
Hi, I would like to rotate a cube towards a cylinder, but Quaternion.Slerp does not work, the cube does not rotate at all. Would you know why? The following code is attached to another object (not attached to "from" or "to", but to a third object) : The first line works fine, but does not interpolate, so i tried with the second one, but it does not work : from.rotation = Quaternion.FromToRotation(from.position, to.position);//this works //or from.rotation = Quaternion.Lerp(from.rotation, to.rotation, 0.5);//this does not work I also found this topic : http://answers.unity3d.com/questions/321799/quaternionlerp-problem-excluding-an-axis.html and i tried the code below in the same script as the character i would like to rotate, but same thing: no reaction : #pragma strict var target: Transform; function Update () { var flatVersion: Quaternion; flatVersion = Quaternion.Euler( target.rotation.eulerAngles.x, target.rotation.eulerAngles.y, 0.0 ); transform.rotation = Quaternion.Slerp( transform.rotation, flatVersion, Time.deltaTime * .5 ); } Any idea? Thanks

Viewing all articles
Browse latest Browse all 133

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>