Announcement

Collapse
No announcement yet.

Issue while lerping a float representing an angle

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Issue while lerping a float representing an angle

    I need to lerp a float that determines the angle of a character's bone. However, since angles go from -180 to 180, at some point the value is going to invert, and it will result in the character doing a reverse spin to reach the new point.



    In this gif, I wait for the alpha value of the lerping to reach 1, then I start rotating to show it works in that case.
    However, if I later show what happens if reach the point where the angle inverts while still lerping, and it will do the reverse spin I'm talking about.
    I'm pretty much looking for a blueprint new lerp function that won't allow that to happen, as any attempt to make one myself didn't quite get me where I wanted.


    #2
    I think lerp nodes have a "use shortest path" checkbox. Try turning those on if you haven't.
    DO contact me with questions about Blueprint or other Unreal features! I don't bite! Or charge money! Just press that blue Skype button and fire away.

    Project Culverin - Open Ended First Person Shooter

    Comment


      #3
      You could try storing your angle in a Rotator and lerp that. The rotator lerp has the functionality to properly handle angle wrapping.

      Comment


        #4
        Oh wow, thanks to both of you. I was just using the normal float lerp, ignoring Rotators had a lerp function attached. I tried looking for one by unchecking context sensitive while creating a node, thinking I would have searched into everything like that.

        I will test and let you know.

        EDIT: It works, problem solved.
        Thanks again, a bunch.
        Last edited by funkbro; 08-20-2014, 07:52 PM.

        Comment

        Working...
        X