Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

182
Views
Achieve ease in ease out in Vector3 Lerp

I am moving my camera from origin to destination, it all works well but the problem is that there is no smooth ease in/out from origin to destination. How do I achieve a smooth ease in when camera is travelling and smooth ease out when the camera reaches the destination? It is necessary to have totalMovementTime as I want my camera to reach the destination in given seconds.

public IEnumerator MoveToDestination () {

        float totalMovementTime = 2f; 
        float currentMovementTime = 0f;
        while (Vector3.Distance (transform.localPosition, destinationCamPos) > 0) {
            currentMovementTime += Time.deltaTime;
            transform.localPosition = Vector3.Lerp (transform.localPosition, destinationCamPos, currentMovementTime / totalMovementTime);
            yield return null;
        }
    }
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

You can use the AnimationCurve for "easy" easing :) Create a serialized field in your script of type AnimationCurve. In inspector play with it making the desired easing curve (there are also ready to use presets). Then for the step (progress) of your lerp you need to "evaluate" using your curve AnimationCurve.Evaluate Make sure your are using the normalized value for the Lerp progress.

[SerializedField] AnimationCurve curve;
...
var normalizedProgress = currentMovementTime / totalMovementTime ; // 0-1
var easing = curve.Evaluate(normalizedProgress);
transform.localPosition = Vector3.Lerp (transform.localPosition, destinationCamPos, easing);
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!