Quantcast
Viewing all articles
Browse latest Browse all 133

Quaternion.Slerp issue

I'm trying to rotate my camera using Quaternion.Slerp. I'm getting the desired rotation angle, but it's snapping to the rotation. I declared a float called "elapsed" and attempted to increment it during a while loop within the coroutine. The issue is that on key press my "elapsed" float is jumping straight to the "spinTime" float value. Here's the section of relevant code: private IEnumerator Spin() { elapsed = 0; while (elapsed < spinTime) { elapsed += Time.deltaTime; camHolder.transform.rotation = Quaternion.Slerp(transform.rotation, spinTarget, spinTime); } yield return null; } Thanks in advance, everyone :)

Viewing all articles
Browse latest Browse all 133

Trending Articles



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