I'm sure I'm missing this and it's somewhere but I'm having trouble finding how to set an object's angle (e.g. in the transform) .

I can add to the current angle, I can rotate an object toward a point in space,but I can't figure out how to say "Set angle to X"

Any help finding this? I'm sure it's there somewhere.
  • Hm, damn ... could be that this was never added, and so far nobody mentioned or needed it.
    I'll look into it and add it in the next update.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • I tried to use Check Transform to keep track of the angle and it seems that it doesn't have an option to work in local space. E.g. I have child objects that have an angle of 0 degrees, but if the parent object is rotated, the child is seen as rotated by the Check Transform block.
  • I'm now also trying to use 'Check Angle'

    Apparently 1.707547e-05 does not count as 'approximately' 0 :D

    Though, 90.00002 counts as 'approximately' 90 interestingly enough :)

    I wonder if it has to do with wrapping angles. When I input 360 instead of 0 in the inspector during runtime it converts it to 3.733867e-05 which also wont' be recognized as 0 by Check Angle.
  • Well, that's up to Unity what they count as approximately, it's their Math function :D
    You can try Range Inclusive or Range Exclusive to check for a wider angle.

    Local position/rotation check in the Check Transform step will be coming in the next update.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • edited February 2016
    I did try range (0 to 1), and it also didn't work. That's why I was thinking it could be a wrapping issue. E.g. 360 should be 0 degrees. 360 converts to 3.733867e-05, but is not considered to be either 0 or approximately 0. Doing -1 to 0, or 0 to 1 inclusive does not work. Doing -1 to 1 inclusive works.... Very confused by this behavior :)

    On the other hand, unlike the Check Angle block, the Check Transform block seems to work.

    Oh and one more rotation thing. When I use Change rotation block, the rotation seems to be off by a small amount that adds up over time. So let's say I do Change Rotation by +90, then Change rotation by -90. First it will rotate to 90.00001 , then after i rotate back -90 it rotates to a bit more than 0, then if I do it again it will rotate to 90.00002, etc, and it keeps building up. I'm rotating with linear interpolation if that matters. I need the rotation to be gradual. How can I make it be exact?
    Post edited by Juryiel on
  • edited February 2016
    Hm, looks like having 2 Change Rotation steps without a wait between them causes the rotation to go off (even a Wait step of 0 between them will solve that). Is that your setup?
    Might have something to do with the last rotation of the 1st step happening in the same frame as the 1st rotation of the 2nd step - I'll investigate.
    Post edited by gamingislove on
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • Ah yes, i do have 2 rotations going together (2 sides of a double-door opening). Thanks for looking into it!
  • Yes, it's definitely because of that - add a Wait step with a time of 0 to just wait for the next frame and it should work fine.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • Yeap, I did that :) Currently baking some things so I can't test it but I'm sure it will work because that is exactly my setup :)
  • edited March 2016
    I finally had time to check this out. It seems the wait steps do prevent error from accumulating. There are still rounding errors which I think are due to unity, but those are easy to deal with using the range settings :)

    Of note, 275deg does not currently equal -85 deg when doing the comparisons. Not sure if it's worth adding appropriate angle wrapping but i thought I'd note it anyway.

    Also, it would also be nice if the Set Angle setting could operate in both the local and global space :)

    But with all that said, I can now open and close doors to my heart's content without error slowly accumulating :) Thanks!
    Post edited by Juryiel on
Sign In or Register to comment.