Hi there,
I’m trying to make an object (fireball) bounce between -4 and 10 on the Y Axis, without Rigidbody, and such. Instead, the object gets stuck on the exact same position.
void Update () {
if (transform.position.y == -4) {
transform.position = new Vector3(transform.position.x,Mathf.Lerp(min,max,Time.time),transform.position.z);
}
if (transform.position.y == 10) {
transform.position = new Vector3(transform.position.x,Mathf.Lerp(max,min,Time.time),transform.position.z);
}
}
I suspect the “==” causes the trouble, but “>” and “<” cause other problems.