Angle problems in r244

Bugs will be moved here once resolved.

Post » Mon May 29, 2017 6:45 pm

Problem Description
____ C2 has a problem with angles except 0 . for example set your sprite angle to 180 , it will set something more than 180 and we have some problems with events . ____

Attach a Capx
____ https://drive.google.com/open?id=0B1yUi ... XdYVnpsQUk ____

Description of Capx
____ A sprite with angle 180 and a textbox to show the angle. ____

Steps to Reproduce Bug
  • Create a sprite and set angle to 180.
  • Create a textbox .
  • Make an event to set textbox.text to sprite.angle

Observed Result
____ Textbox show the angle more than 180 and sprite didn't destroy. ____

Expected Result
____ Textbox should show 180 and the sprite must be destroyed . ____

Affected Browsers
  • Chrome: (YES)
  • FireFox: (YES)
  • Internet Explorer: (NO)

Operating System and Service Pack
____ Win 7 Ultimate 64-bit service pack 1 ____

Construct 2 Version ID
____ R244 ____

NOTE : It doesn't have any problem if you set the angle using event .
Last edited by mehrshadfarahani on Fri Jun 02, 2017 7:47 am, edited 1 time in total.
B
18
S
8
G
2
Posts: 48
Reputation: 2,504

Post » Tue May 30, 2017 6:26 am

The manual does recommend not using "is equal to" for angles instead use "is within"

Interestingly if you set the sprite angle to -180 it will be read as exactly 180

Probably something with how angles are calculated in C2 and in computers in general.

Interesting tho.....
...
B
44
S
23
G
7
Posts: 286
Reputation: 7,985

Post » Tue May 30, 2017 6:39 am

NetOne wrote:
Interestingly if you set the sprite angle to -180 it will be read as exactly 180


I check it . nothing changed , it still has problem !
B
18
S
8
G
2
Posts: 48
Reputation: 2,504

Post » Mon Jun 19, 2017 2:49 am

I tested the bug in r243 and it acts exactly as you said. It appears an internal issue, but you can do an aprox validation.
B
10
S
1
Posts: 33
Reputation: 625

Post » Thu Jun 22, 2017 4:04 pm

Closing as not a bug. Internally C2 stores angles as radians, so it converts degrees to radians. However, CPUs are not perfectly accurate at math. See "Expecting math calculations to be exact" in this blog. It's normal to get results that are close to, but not exactly, the answer you want, hence the need to accept a small range.
Scirra Founder
B
395
S
232
G
88
Posts: 24,371
Reputation: 193,762


Return to Closed bugs

Who is online

Users browsing this forum: No registered users and 4 guests