Abdou023
Abdou023

Reputation: 1664

Animation curve evaluate

I'm not sure how to assign speed to my Animation curve:

public float speed;
public AnimationCurve ac;

transform.position = Vector3.Lerp(pos1, pos2, ac.Evaluate( ??? ));

I'm using it inside a coroutine.

Upvotes: 2

Views: 1942

Answers (1)

Eldar
Eldar

Reputation: 153

You can write:

ac.Evaluate(deltaTime * speed);

According to Unity docs:

public float Evaluate(float time);

Description

Evaluate the curve at time.

Parameter time

The time within the curve you want to evaluate (the horizontal axis in the curve graph).

Returns float

The value of the curve, at the point in time specified.

Upvotes: 2

Related Questions