playMaker

Author Topic: Rotate object problem  (Read 2426 times)

TommyA

  • Playmaker Newbie
  • *
  • Posts: 26
Rotate object problem
« on: August 29, 2012, 09:32:06 AM »
Hi,
I'm testing object rotation with PlayMaker.
It's very simple action.

Every button down,
1. get rotation value of object.
2. add 90 degree to y-angle.
3. set rotation value of object.

It works but sometimes it does not returns exact value.
Attached pic is about rotate from 0 degree of y-angle, rotate 90 degree and return to 0 degree.
So it should be 0 degree of y-angle but it's not. (not 0 but 7.629395E-06)
Why this happen?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Rotate object problem
« Reply #1 on: August 29, 2012, 04:25:29 PM »
Hi,

 this is simply the float approximation of 0 in your case, 7.629395E-06 = 0.000007629395 so really it means 0

 You will find this in many cases, where you can't even check if two floats are equals like ints:

http://answers.unity3d.com/questions/48866/how-to-compare-float-for-equality.html

so, in short, this is not something wrong with Unity, not playmaker.

Now, it could be also that your gameObject is not exactly spot on in its rotation, or it could be a physics driven gameObject in which case these kind fo values are the norm.


bye,

 Jean