- Home /
This question was
closed Jun 30, 2015 at 08:20 AM by
fafase for the following reason:
The question is answered, right answer was accepted
Question by
Jakeiiii · Jun 30, 2015 at 08:11 AM ·
c#mathfmathf.lerp
Mathf.Lerp not working, why?
This is a snippet of the code where Mathf.Lerp isn't working:
if(distAway != origDA){
// Debug.Log(distAway);
Mathf.Lerp(distAway, origDA, Time.deltaTime * 30f);
// Debug.Log(distAway);
if(distAway >= origDA - 0.2f)
distAway = origDA;
}
The console prints out the values for 'distAway' before and after the lerp function which remains the same. 'origDA' is NEVER changed, and is always equal to '8' and prints out '8' in the console if I write out Debug.Log(origDA). 'distAway' is less than 'origDA' and is meant to lerp to 'origDA'. Why isn't it running? It's reaching the function; 'distAway' isn't equal to 'origDA'. What's stopping the Mathf.Lerp function from working?
Comment
Best Answer
Answer by Jakeiiii · Jun 30, 2015 at 08:19 AM
Oh, I didn't assign 'distAway' to equal to the Mathf.Lerp function. Okay, problem solved.