- Home /
Question by
Stone-Legion · Dec 05, 2014 at 06:15 PM ·
c#rotationquaternionlerp
Quaternion.Lerp shaky while in coroutine?
This is very bizarre how it is shaking so much even when smoothing it out. Any suggestions on the code below so it isn't stuttering and shakey?
public void Flip()
{
foreach(Transform child in gameManager.playerCoreChildren)
{
StartCoroutine(Helper.LerpRotate(child.rotation,
Quaternion.Euler(new Vector3(0,0,0)),
1f ,
child));
}
}
public static IEnumerator LerpRotate(Quaternion start, Quaternion end, float lerpLength, Transform transF)
{
float t = 0;
while (t <= 1.0f) {
t += Time.deltaTime / lerpLength;
transF.rotation = Quaternion.Lerp (start, end, Mathf.SmoothStep (0.0f, 1.0f,Mathf.SmoothStep (0.0f, 1.0f, t)));
yield return null;
}
}
Comment
What's the context that you have it shaking in? A rigidbody object?
Answer by Baste · Dec 06, 2014 at 10:53 AM
shaking is usually a result of you changing the same property - position or rotation - in two different scripts at the same time.