Question by
Fr33zerPop · Apr 24, 2018 at 09:51 PM ·
rotationlerpeasing
Keep "ball" character's face rotating to be up?
I have a 2D character that can roll around (via physics), but I want his face/expression to always try to become right-side up. Can I add some sort of slow lerp, so that he can go upside down when rolling, but then try to become right-side up once he slows/stops?
Something like this?
void Update(){
currentLerpTime += Time.deltaTime;
if (currentLerpTime > lerpTime)
{
currentLerpTime = lerpTime;
}
float t = currentLerpTime / lerpTime;
t = t*t*t * (t * (6f*t - 15f) + 10f) //ease in/out
transform.Rotate = ??? // Need help here
}
Comment