playMaker

Author Topic: How to use clamp properly?  (Read 1036 times)

thunder

  • Playmaker Newbie
  • *
  • Posts: 22
How to use clamp properly?
« on: April 20, 2022, 02:14:43 PM »
I have a variable that I want to clamp to something between its own value -10 and +10, but the clamp action in its min and max fields only allows me to use another variable or a specific number value, not a mathematical operation. How do I do that? Thanks.

wetcircuit

  • Full Member
  • ***
  • Posts: 158
    • wetcircuit.com
Re: How to use clamp properly?
« Reply #1 on: April 20, 2022, 02:46:20 PM »
Easiest way is probably a couple math operators that create the min/max variables before the clamp action.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7618
    • jinxtergames
Re: How to use clamp properly?
« Reply #2 on: April 20, 2022, 03:32:57 PM »
Hi.
If between its own value it will not work as when you change its value it will also change the min/max.

you can get a 'Default value' then use 2 int/float operators and do -10 and +10
the result you can use in the min/max