# Subtract Two Floats Over Time(Smoothly)?

**URL:** <https://forums.unrealengine.com/t/subtract-two-floats-over-time-smoothly/404612>\
**Category:** Community & Industry Discussion\
**Tags:** timeline, lerp, timer, unreal-engine, rotate, question, rinterpto\
**Created:** [September 15, 2017, 2:13am UTC](https://forums.unrealengine.com/t/subtract-two-floats-over-time-smoothly/404612 "2017-09-15T02:13:17Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_079e56df1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_079e56df1](https://forums.unrealengine.com/u/anonymous_user_079e56df1)\
**Post date:** [September 15, 2017, 2:13am UTC](https://forums.unrealengine.com/t/subtract-two-floats-over-time-smoothly/404612/1 "2017-09-15T02:13:17Z")

</div>

Hello, I have a very simple BP which triggers an event every 2 seconds. And that event gets the collision capsule rotation (yaw value) and substracts the control rotation(yaw value) from it.

 ![213558-smoothrotate.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/3/3/c33185a4181340465b03a4bdd09f334601e1936e.png)

This results in an instant snap of capsule to rotation wanted. How can I make it so that capsule rotation rotates smoothly to the yaw value wanted? I tried using timeline, lerp and Rinterp to nodes but they didn’t quite work or I did something wrong.

Thank you for any suggestions/responses.

P.S. use pawn control rotation is checked off so mouse inputs shouldn’t be an interuptor in this case

---

<div class="post-metadata">

**Author:** ![Nachtmahr](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Nachtmahr](https://forums.unrealengine.com/u/Nachtmahr)\
**Post date:** [September 15, 2017, 2:21am UTC](https://forums.unrealengine.com/t/subtract-two-floats-over-time-smoothly/404612/2 "2017-09-15T02:21:29Z")

</div>

The Problem is that you trigger only every 2 seconds. Instead of Rotating there do your rotation on Tick. In your Timer you can simply set a Float variable to hold the Yaw rotation you want and use that Variable in your tick. You can use interpolation for this.

Good Luck and have Fun =)

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_079e56df1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_079e56df1](https://forums.unrealengine.com/u/anonymous_user_079e56df1)\
**Post date:** [September 16, 2017, 12:50am UTC](https://forums.unrealengine.com/t/subtract-two-floats-over-time-smoothly/404612/3 "2017-09-16T00:50:48Z")

</div>

Hello Nachtmahr. Thank you for your prompt reply. I tried many ways but no help. what I might be doing wrong?

 ![213666-smoothrotate2.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/9/6/9968b36ccca50757111833647ecf31c6ba56a785.png)

 ![213667-smoothrotate3.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/9/9/8991f97ef7e6e29944df630c9bb73c4117c94639.png)

---

<div class="post-metadata">

**Author:** ![Nachtmahr](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Nachtmahr](https://forums.unrealengine.com/u/Nachtmahr)\
**Post date:** [September 16, 2017, 1:11am UTC](https://forums.unrealengine.com/t/subtract-two-floats-over-time-smoothly/404612/4 "2017-09-16T01:11:09Z")

</div>

Hi there Axe the Problem is the same you call it only every 2 seconds from the timer. You have to move your Code to tick. Interpolation and AddLocalRotation needs to be there.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_079e56df1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_079e56df1](https://forums.unrealengine.com/u/anonymous_user_079e56df1)\
**Post date:** [September 16, 2017, 4:44pm UTC](https://forums.unrealengine.com/t/subtract-two-floats-over-time-smoothly/404612/5 "2017-09-16T16:44:43Z")

</div>

Hello back Nachtmahr. Moving the code (AddLocalRot and Interp) to tick made rotations smoother but it causes character to rotate with mouse every frame. What I have is character moves his head(Not the whole character) with the mouse. What I am trying to do is to rotate the whole character to the rotation of the control rotation (Head bone) every 2 Seconds so that is is more realistic. Please excuse my lack of experience in this game engine and coding.

Thank you for answering my questions Nachtmahr.

---

<div class="post-metadata">

**Author:** ![Nachtmahr](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Nachtmahr](https://forums.unrealengine.com/u/Nachtmahr)\
**Post date:** [September 16, 2017, 6:52pm UTC](https://forums.unrealengine.com/t/subtract-two-floats-over-time-smoothly/404612/6 "2017-09-16T18:52:12Z")

</div>

No Problem man here is a Screenshot of what you want.

 ![](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/6/f/d6f99a147af3e3b44c5ce640f8dcb300a8b509a2.png)

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_079e56df1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_079e56df1](https://forums.unrealengine.com/u/anonymous_user_079e56df1)\
**Post date:** [September 16, 2017, 7:44pm UTC](https://forums.unrealengine.com/t/subtract-two-floats-over-time-smoothly/404612/7 "2017-09-16T19:44:55Z")

</div>

@Nachtmahr, Thank you man, it worked nicely. I very appreciate your help and support!
