playMaker

Author Topic: Clamp Inverted  (Read 1680 times)

tiqlat

  • Playmaker Newbie
  • *
  • Posts: 8
Clamp Inverted
« on: February 12, 2019, 05:24:10 AM »
Hi. Is there an action for clamping the float but ``inverted``. What i mean by that.  I have a float variable which changes between -1 and 1. i want it to be either -0.5 to -1 or 0.5 to 1.   Right now with normal clamp i can make clamping from the edges.  For instance from 0.5 to 1 or from -0.5 to -1. But this is not what i want.  So i don`t want my variable to have a number between -0.5 to 0.5.  Is there any action which does this? or any tips how to achieve what i want.

LordHorusNL

  • Beta Group
  • Full Member
  • *
  • Posts: 226
Re: Clamp Inverted
« Reply #1 on: February 12, 2019, 11:26:19 AM »
Try the "Float Remap" action on the ecosystem, that should do the trick.

Thore

  • Sr. Member
  • ****
  • Posts: 480
Re: Clamp Inverted
« Reply #2 on: February 12, 2019, 11:27:34 AM »
You need to specify what exactly happens with the -0.5—0.5 range in the middle. If you assume that anything between -0.5 to 0 counts as -0.5, you need to handle that case extra, and do the same thing for 0 to 0.5 (which might count as 0.5). If that’s the case. If you want a deadzone, then you don‘t need to clamp at all, but set the output variable to 0 if the value is between -0.5 to 0.5.

tiqlat

  • Playmaker Newbie
  • *
  • Posts: 8
Re: Clamp Inverted
« Reply #3 on: February 12, 2019, 01:20:28 PM »
Try the "Float Remap" action on the ecosystem, that should do the trick.
Thanks for the answer friend. I checked the action you told but it is not exactly what i want. I want a dead zone between minimum and maximum of my float. If minimum value my variable has lets say 1 and maximum is 10 i want dead zone between 4 and 6.   So if the value is higher than 5 it should be 6 at least. And if the value is between 4 and 5 it should be 4. Something like that.

tiqlat

  • Playmaker Newbie
  • *
  • Posts: 8
Re: Clamp Inverted
« Reply #4 on: February 12, 2019, 01:22:27 PM »
You need to specify what exactly happens with the -0.5—0.5 range in the middle. If you assume that anything between -0.5 to 0 counts as -0.5, you need to handle that case extra, and do the same thing for 0 to 0.5 (which might count as 0.5). If that’s the case. If you want a deadzone, then you don‘t need to clamp at all, but set the output variable to 0 if the value is between -0.5 to 0.5.
Yes friend i want exactly the dead zone between the minimum and maximum values. If minimum value of my variable has lets say 1 and maximum is 10 i want dead zone between 4 and 6.   So if the value is higher than 5 it should be 6 at least. And if the value is between 4 and 5 it should be 4. Something like that. How to achieve that?

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: Clamp Inverted
« Reply #5 on: February 12, 2019, 09:36:20 PM »
Hi.
Try this :

Use 2 states.

On state 1 and 2 :
Use a float compare before using the clamp action.

On state 1 :
Check if greater than 5, then go to state 2.
If less then do noting.

On state 2 :
Check if less than 5, then go to state 1.
If greater do nothing.

In state 1 use clamp 1-4 in state 2 clamp 6-9 below the float test.

tiqlat

  • Playmaker Newbie
  • *
  • Posts: 8
Re: Clamp Inverted
« Reply #6 on: February 13, 2019, 01:10:00 AM »
Hi.
Try this :

Use 2 states.

On state 1 and 2 :
Use a float compare before using the clamp action.

On state 1 :
Check if greater than 5, then go to state 2.
If less then do noting.

On state 2 :
Check if less than 5, then go to state 1.
If greater do nothing.

In state 1 use clamp 1-4 in state 2 clamp 6-9 below the float test.

Thanks a lot. That makes sense. will try what you said. and write here the result