# Why lerp always returns 0 when works with variables

**URL:** <https://forums.unrealengine.com/t/why-lerp-always-returns-0-when-works-with-variables/474160>\
**Category:** Cinematics & Media\
**Tags:** timeline, not-working, lerp, unreal-engine, question, Blueprint\
**Created:** [November 8, 2020, 11:15am UTC](https://forums.unrealengine.com/t/why-lerp-always-returns-0-when-works-with-variables/474160 "2020-11-08T11:15:51Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![BarryR](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/barryr/32/1093485_2.png) [@BarryR](https://forums.unrealengine.com/u/BarryR)\
**Post date:** [November 8, 2020, 11:15am UTC](https://forums.unrealengine.com/t/why-lerp-always-returns-0-when-works-with-variables/474160/1 "2020-11-08T11:15:51Z")

</div>

I want to use mosue wheel to control camera zoom in/out ,but the the lerp node always return 0.Default TargetArmLength is 4096, MaxArmLength is 4096 ,MinArmLength is 1024.  
Anyone can help me to fingure out this?  
Here are my blueprint and my timeline.

 ![321424-1.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/c/a/5caeaa96d5c1fcec62e0d0bd8792eb2f563569c1.png)

 ![321425-2.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/5/c/95c4d37176ba4570d2e2fac996401d07d2d5a192.png)

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [November 8, 2020, 11:39am UTC](https://forums.unrealengine.com/t/why-lerp-always-returns-0-when-works-with-variables/474160/2 "2020-11-08T11:39:31Z")

</div>

Take out the branches and DoOnce, then connect to the play and reverse pins. Should do it…

---

<div class="post-metadata">

**Author:** ![BarryR](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/barryr/32/1093485_2.png) [@BarryR](https://forums.unrealengine.com/u/BarryR)\
**Post date:** [November 8, 2020, 11:43am UTC](https://forums.unrealengine.com/t/why-lerp-always-returns-0-when-works-with-variables/474160/3 "2020-11-08T11:43:14Z")

</div>

Still not working. Return 0 again.

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [November 8, 2020, 11:44am UTC](https://forums.unrealengine.com/t/why-lerp-always-returns-0-when-works-with-variables/474160/4 "2020-11-08T11:44:23Z")

</div>

Where are you getting zero?

---

<div class="post-metadata">

**Author:** ![BarryR](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/barryr/32/1093485_2.png) [@BarryR](https://forums.unrealengine.com/u/BarryR)\
**Post date:** [November 8, 2020, 11:47am UTC](https://forums.unrealengine.com/t/why-lerp-always-returns-0-when-works-with-variables/474160/5 "2020-11-08T11:47:41Z")

</div>

The Alpha value output from timeline is correct, but the return value of lerp is always 0.

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [November 8, 2020, 11:50am UTC](https://forums.unrealengine.com/t/why-lerp-always-returns-0-when-works-with-variables/474160/6 "2020-11-08T11:50:36Z")

</div>

Put min and max arm length the other way around 🙂

---

<div class="post-metadata">

**Author:** ![BarryR](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/barryr/32/1093485_2.png) [@BarryR](https://forums.unrealengine.com/u/BarryR)\
**Post date:** [November 8, 2020, 12:25pm UTC](https://forums.unrealengine.com/t/why-lerp-always-returns-0-when-works-with-variables/474160/7 "2020-11-08T12:25:37Z")

</div>

Thanks a lot. I set the values directly, it’s working now.

 ![321429-1.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/7/a/a7a0981f7e9036735f17d3612f2acc7dfb11bd66.png)

Do you know why it’s not working with the variable？

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [November 8, 2020, 12:27pm UTC](https://forums.unrealengine.com/t/why-lerp-always-returns-0-when-works-with-variables/474160/8 "2020-11-08T12:27:49Z")

</div>

I think because you had the variables the wrong way around ( or the names were anyway… )

---

<div class="post-metadata">

**Author:** ![BarryR](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/barryr/32/1093485_2.png) [@BarryR](https://forums.unrealengine.com/u/BarryR)\
**Post date:** [November 8, 2020, 12:34pm UTC](https://forums.unrealengine.com/t/why-lerp-always-returns-0-when-works-with-variables/474160/9 "2020-11-08T12:34:41Z")

</div>

I created these two variables and set their default value to 4096 and 1024，then connect them to the lerp node.

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [November 8, 2020, 12:43pm UTC](https://forums.unrealengine.com/t/why-lerp-always-returns-0-when-works-with-variables/474160/10 "2020-11-08T12:43:38Z")

</div>

Yes, but the low one has to go in A.

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [November 8, 2020, 12:44pm UTC](https://forums.unrealengine.com/t/why-lerp-always-returns-0-when-works-with-variables/474160/11 "2020-11-08T12:44:34Z")

</div>

Sorry, yeah, it should work either way… Did you initialize the variables?

---

<div class="post-metadata">

**Author:** ![BarryR](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/barryr/32/1093485_2.png) [@BarryR](https://forums.unrealengine.com/u/BarryR)\
**Post date:** [November 8, 2020, 12:52pm UTC](https://forums.unrealengine.com/t/why-lerp-always-returns-0-when-works-with-variables/474160/12 "2020-11-08T12:52:35Z")

</div>

Yes. I initialize the variables with event begin node.

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [November 8, 2020, 12:55pm UTC](https://forums.unrealengine.com/t/why-lerp-always-returns-0-when-works-with-variables/474160/13 "2020-11-08T12:55:37Z")

</div>

Do you mean BeginPlay? Did you try setting their defaults in the details panel?

---

<div class="post-metadata">

**Author:** ![BarryR](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/barryr/32/1093485_2.png) [@BarryR](https://forums.unrealengine.com/u/BarryR)\
**Post date:** [November 8, 2020, 1:23pm UTC](https://forums.unrealengine.com/t/why-lerp-always-returns-0-when-works-with-variables/474160/14 "2020-11-08T13:23:06Z")

</div>

Yes. Both BeginPlay and their defaults

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [November 8, 2020, 4:19pm UTC](https://forums.unrealengine.com/t/why-lerp-always-returns-0-when-works-with-variables/474160/15 "2020-11-08T16:19:53Z")

</div>

You have a small mistake in your code somewhere, maybe post the whole lot.

If there was a bug here, the entire world would know about it 🙂

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_0d5d0b83](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_0d5d0b83](https://forums.unrealengine.com/u/anonymous_user_0d5d0b83)\
**Post date:** [November 11, 2020, 8:25pm UTC](https://forums.unrealengine.com/t/why-lerp-always-returns-0-when-works-with-variables/474160/16 "2020-11-11T20:25:08Z")

</div>

Hello,

We’ve made a switch to a new bug reporting method using a more structured form. Please visit the link below for more details and report the issue using the new Bug Submission Form. Feel free to continue to use this thread for community discussion around the issue.

Thanks
