playMaker

Author Topic: [SOLVED]Float changed with tolerance  (Read 3520 times)

Krillan87

  • Beta Group
  • Full Member
  • *
  • Posts: 185
[SOLVED]Float changed with tolerance
« on: June 12, 2019, 09:03:13 AM »
Hi,

I have a situation where I need to preform an action when the rotation (a float) is changed on a gameobject. However, he object is never fully still, and is moving and rotating veeery slightly all the time due to the physics engine. I would like the use the "float changed" but the action triggers even if the float just moves 0.00001 units.

Is is possible to add a tolerance value to the float changed-action similar to the on in "Float compare"?

/Christian
« Last Edit: July 05, 2019, 10:44:08 AM by djaydino »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7620
    • jinxtergames
Re: Float changed with tolerance
« Reply #1 on: June 13, 2019, 10:19:04 AM »
Hi.
Can you try the attachment below?

Let me know if it works correct so i can add this to the Ecosytem or ask Alex if i can update the original.

Krillan87

  • Beta Group
  • Full Member
  • *
  • Posts: 185
Re: Float changed with tolerance
« Reply #2 on: June 24, 2019, 05:43:22 AM »
Hi.
Can you try the attachment below?

Let me know if it works correct so i can add this to the Ecosytem or ask Alex if i can update the original.

Sorry for late reply but it works like a charm, thank you very much!

I have just another random question that maybe your experience and insight could help. So I use this action to check if a box is rotating, and if it is rotating, an event will go off and do stuff to the box (let's say I want to active a particle system ONLY when it is rotating). Now I need a good way to check if the box is NOT rotating anymore (or is done rotating) because then I should stop the particle system.

I often find myself in situations where I want to know if an gameobject is NOT moving or is NOT rotating or is NOT doing something, but I don't really have a good way of doing this.

any input?

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7620
    • jinxtergames
Re: Float changed with tolerance
« Reply #3 on: June 24, 2019, 07:35:31 AM »
Hi.
Probably by using 'Get Angular Velocity' (Ecosystem)
and a Vector 3 compare

Krillan87

  • Beta Group
  • Full Member
  • *
  • Posts: 185
Re: Float changed with tolerance
« Reply #4 on: June 26, 2019, 09:17:54 AM »
Hi.
Probably by using 'Get Angular Velocity' (Ecosystem)
and a Vector 3 compare

Ah good idea but I forgot to tell you that the game is in 2d, and the Get Anugular Velocity only works in 3D. Maybe there is an easy way to convert the action into a 2d-action?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15594
  • Official Playmaker Support
Re: Float changed with tolerance
« Reply #5 on: July 05, 2019, 04:43:45 AM »
Hi,

 Kurt, can you you put that action on the ecosystem, thanks :)

 Bye,

 Jean