playMaker

Author Topic: Problem - Clamping Rotation: Max Value works but Min Value "not"  (Read 3926 times)

codemonkey

  • Playmaker Newbie
  • *
  • Posts: 1
Hi guys maybe someone can tell me how to figure this out:

I rotate an object by touch input on my phone. If I clamp the x and y rotation of an object to minValue 0 and maxValue 10 then the maxValue works and it does not go beyond the x  and y maxValue of 10 and it just stays at this position but in case of the minValue things are getting weird. As soon as I try to rotate below the minValue then it changes the rotation to 10 instead of staying at 0. What am I missing here? Is there any easy playmaker solution for this?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Problem - Clamping Rotation: Max Value works but Min Value "not"
« Reply #1 on: June 14, 2017, 04:58:30 AM »
Hi,

 it's logical if the calue is an angle in degree. it goes from 0 to 360 and if you go positive, it goes up, but you go directly from 0 to 360 on the the other side, maxing out to your positive clamp value.

 for this, you should turn your rig 90° so that you clamp your angle between 80 and 100 for a 20° range.

Does that make sense?

 Bye,

 Jean


hx

  • Playmaker Newbie
  • *
  • Posts: 13
Re: Problem - Clamping Rotation: Max Value works but Min Value "not"
« Reply #2 on: June 16, 2017, 11:08:35 AM »
i dont really get what you mean. can u make an example?


Hi,

 it's logical if the calue is an angle in degree. it goes from 0 to 360 and if you go positive, it goes up, but you go directly from 0 to 360 on the the other side, maxing out to your positive clamp value.

 for this, you should turn your rig 90° so that you clamp your angle between 80 and 100 for a 20° range.

Does that make sense?

 Bye,

 Jean

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Problem - Clamping Rotation: Max Value works but Min Value "not"
« Reply #3 on: June 19, 2017, 07:35:21 AM »
Hi,

 Here's the problem:



and so you can't clamp an angle like that when the middle value is 0.

 so then the solution is to turn everything 90° or even 180°, then your default middle value will be say 90° or 180° and clamping can then be done around that value.

 but the solution to apply depends on your system, it depends how you control the rotation, can you give more details on how the rotation is controlled? is it a user input, a look at behavior, etc?

Bye,

 Jean

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: Problem - Clamping Rotation: Max Value works but Min Value "not"
« Reply #4 on: June 19, 2017, 08:55:30 AM »
Hi,
I looked at your scene and made 3 scenes all 3 work but the 2nd and 3rd seem to work smoother.

on the 2nd i made an empty object and set the cube as a child, then i rotate x on the parent (the empty object) and y on the cube.

The difference between 2 and 3 are that the 3rd one x and y rotation are split in 2 fsms.

What jean said is right
On the sample you can see that i have set the clamp to -180 and 180

If you want to have a different starting position set the x rotation on the parent and the y on the cube, then also set the value from the angle_x and angle_y variable

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Problem - Clamping Rotation: Max Value works but Min Value "not"
« Reply #5 on: June 29, 2017, 02:40:04 AM »
Hi,

 thanks for making them samples!

 Bye,

 Jean