Rounded Angle

Discussion in 'GENERAL DISCUSSION' started by Omx, Jan 20, 2016.

  1. Omx

    Omx Member

    Hi,

    So, the setup is as follows;
    • One propeller ( joint with no motor, slight slow rotation, so can be pushed).
    • Two small needles with rotation events (as pivots) for testing purposes.
    • Variables; two chains, to be discussed below.
    • Timer for every 0.1 seconds or so linked to an A<B thing (I couldn't find one that acts constantly) linked to two set number events.
    So, one needle's rotation event is hooked straight to the propeller angle, so it matches the rotation. No issue. The other needle's rotation is the propeller angle, divided by 45, rounded (which, as far as I can tell, will only round a value to 0dp), multiplied by 45 again. In this way, it should round the angle to the nearest 45 degrees, right? I'm fairly confident on the maths there.

    The whole setup was linked to one object, with the A<B timer setting the value for the objects rotation to match the pushed propeller, assuming it was turning fast enough (I think about 0.3), otherwise it would set it to the nearest 45 degree angle. However, it doesn't seem to work, hence now hooked up to two test needle's to try to figure out why.

    The two nettles start in sync, but the more I push the propeller round and/or change direction, the more out of sync they get, until they're sometimes completely opposite directions, but I can't figure out why - if I swap round for negation then they stay in sync (albeit reversed) but I can't see how round would cause this.

    Anyone experienced anything similar? Any clues?
     
  2. Omx

    Omx Member

    Oops, sorry; I should have posted this thread in the level editor forum, my bad.
     
  3. Hj326

    Hj326 Hypercloner

    So, if I get what you're saying, when the system works right, one of the needles spins while the other jumps in 45-degree intervals, and they both have the same revolutions/second?
     
  4. Omx

    Omx Member

    Yes, that's basically how it should be, but it's not constant rotation, the propellor is being manually pushed around in either direction, and what I find is it gets out of sync somehow.

    I did a bit of testing this morning (Badlands is my go-to commute game at the mo, & have recently moved on to the level editor) with changing the rounding (as in, larger or smaller multipliers/divisors either side of rounding function) and noticed that actually it never seems to get that far out of sync, it just looked worse the more rounded it was (as in, if it rounds to 45 then it gets maybe 90 - 180 degrees out, but if it rounds to only 5 or 10 then it actually looks pretty close).

    I thought it maybe it's a bug because I was sure of the maths, but I think it's probably something to do with how I've wired it or that I've misunderstood something about how angles and rotation are measured/calculated.
     
  5. Omx

    Omx Member

    Just done the commute home and I think I've fixed it, but I don't know why it works!

    I have to add one to the rounded number, before it's multiplied up again. Then, it starts out of sync, but then works fine as soon as it starts moving, so I coupled it with a collision trigger on the propeller to activate the timer, so it starts in the synchronised position and then swaps to the rounded rotation as soon as the propellor gets pushed. Yaaaay!

    It bugs me that I don't know why it works though. Also, it's taken me so long to figure out that I've lost track of exactly what I was planning to do with it. Oh well, time well spent!
     

Share This Page