Angle property for a sprite instance is not accurate

  • Problem Description

    Sprite.Angle gives a close estimation (but not the exact number) of an instance angle that has been set on its properties.

    Attach a Capx

    https://www.dropbox.com/s/lq5d224p05xi8 ... .capx?dl=0

    Description of Capx

    4 instances of a sprite image have been placed with different angles: 0, 90, 180 and 270.

    A text explains that you can click on sprites to check their angles.

    Clicking a sprite will change the text to its angle.

    Steps to Reproduce Bug

    • Click the sprites.

    Observed Result

    Angle 0 sprite returns 0.

    Angle 90 sprite returns 90.0000025045.

    Angle 180 sprite returns 180.000005009.

    Angle 270 sprite returns 269.9999906653.

    Expected Result

    Angle 0 sprite returns 0.

    Angle 90 sprite returns 90.

    Angle 180 sprite returns 180.

    Angle 270 sprite returns 270.

    Affected Browsers

    • Chrome: YES
    • FireFox: YES
    • Internet Explorer: YES
    • Opera: YES

    Operating System and Service Pack

    Windows 7 Home Premium - Service Pack 1

    Construct 2 Version ID

    Release 233 (64-bit)

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Closing as not a bug, see "Expecting math calculations to be exact" in common mis-used events and gotchas.

    Angles are internally stored in radians and the value in degrees is subject to imperfect calculation precision. All software in computers must anticipate and handle this kind of slight imprecision.

  • Thank you.

    I didn't knew that angles were stored in radians and degrees were then calculated, sorry.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)