Announcement

Collapse
No announcement yet.

How to smoothen single float

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

    How to smoothen single float

    So the question is pretty simple, but i dont know how to achieve this.

    What i have is a physical wheel that recieves torque. Im using get physics angular velocity to recieve rounds per minute info from this wheel (WheelRPM) variable. The problem is that when the wheel recieves somesort of obstacle or impact the value changes too fast. Also the (WheelRPM) variable is linked to sound. Upon obstacle things get a little jijijittery.

    So the question is that is there any way to lets say.. dampen (WheelRPM) value. It would be good if i could get some sort of smoothing for 0.3 seconds.

    I dont mind the wheel motion being jittery but i need to smoothen the float a little bit.

    I couldnt use the Finterp since i dont know what the target is going to be, its a simulation afterall

    Hope i dont sound too complicated

    Thanks

    #2
    Got a video of the problem?
    Inphidel / Brian - Developer of Ultraball
    http://www.ultraballgame.com

    Don't shy away from bugs in your game. Don't play it as intended. Break your game so you can fix it!

    Comment


      #3
      Sure

      For info, the white rotating stick just gives me a visual indication of the Engine RPM's , if youre wondering what it is

      Comment


        #4
        Originally posted by rants15 View Post
        So the question is pretty simple, but i dont know how to achieve this.

        What i have is a physical wheel that recieves torque. Im using get physics angular velocity to recieve rounds per minute info from this wheel (WheelRPM) variable. The problem is that when the wheel recieves somesort of obstacle or impact the value changes too fast. Also the (WheelRPM) variable is linked to sound. Upon obstacle things get a little jijijittery.

        So the question is that is there any way to lets say.. dampen (WheelRPM) value. It would be good if i could get some sort of smoothing for 0.3 seconds.

        I dont mind the wheel motion being jittery but i need to smoothen the float a little bit.

        I couldnt use the Finterp since i dont know what the target is going to be, its a simulation afterall

        Hope i dont sound too complicated

        Thanks
        Without looking at your setup is a bit hard to help, but - here's my suggestion:

        Use a Clamp on your float. If you are calling your function via Tick or a timer, simply clamp the RPM value to +/- a percentage of that float.

        Example for clamp values:

        Save the PreviousRPM as a variable and then on the current frame:

        Current RPM = Clamp(Min, Max)

        Min = PreviousRPM*0.9
        Max = PreviousRPM*1.1

        This keeps the RPM within 10% of its previous value.

        Hopefully this works
        [WIP] Procedural City Generator | RPG AI
        [MARKETPLACE] Animal Behavior Kit | Space Shooter Template | Procedural Foliage Tool | Procedural Park
        [FREE] Modular Road Tool | Action Platformer Template | Radar BP | Free Birds | Procedural Buildings
        Join our Discord

        Comment

        Working...
        X