Can't lerp?????
Hello, I am trying to lerp between two points based on external values, but it just won't work.
Here is my code
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ControlValve: MonoBehaviour {
public OPCDoubleIn opcHeight;
protected float minHeight = -0.4042 f;
protected float maxHeight = -0.4530003 f;
float Lerp(float dV0, float dV1, float dT) {
return (1.0 f - dT) * dV0 + dT * dV1;
}
Vector3 spinnerHeight(float h) {
float dLerpParam = (h - minHeight) / (maxHeight - minHeight);
float height = Lerp(minHeight, (minHeight + maxHeight), dLerpParam);
return new Vector3(0, height, 0.02809986 f);
}
void Update() {
float height = (float) opcHeight.Get();
transform.localPosition = spinnerHeight(height);
}
}
Please can someone help as I am tired of this and also ill.
Thank you.
Comment
Your answer
Follow this Question
Related Questions
what wrong with lerp. 1 Answer
Simple Advice needed - Lerp, SmoothDamp, SmoothStep...... etc. 2 Answers
How to control rocket pathing with Quaternion.Slerp 1 Answer
GameObject Jittering 0 Answers
Color.Lerp over HP 1 Answer