Angle property for a sprite instance is not accurate

Bugs will be moved here once resolved.

Post » Sun Sep 11, 2016 3:23 pm

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)
B
14
S
7
Posts: 18
Reputation: 1,234

Post » Mon Sep 12, 2016 10:48 am

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.
Scirra Founder
B
403
S
238
G
89
Posts: 24,659
Reputation: 196,165

Post » Mon Sep 12, 2016 12:31 pm

Thank you.

I didn't knew that angles were stored in radians and degrees were then calculated, sorry.
B
14
S
7
Posts: 18
Reputation: 1,234


Return to Closed bugs

Who is online

Users browsing this forum: No registered users and 5 guests