Page 1 of 1

Angle problems in r244

PostPosted: Mon May 29, 2017 6:45 pm
by mehrshadfarahani
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 .

Re: Angle problems in r244

PostPosted: Tue May 30, 2017 6:26 am
by NetOne
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.....

Re: Angle problems in r244

PostPosted: Tue May 30, 2017 6:39 am
by mehrshadfarahani
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 !

Re: Angle problems in r244

PostPosted: Mon Jun 19, 2017 2:49 am
by rodimus111
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.

Re: Angle problems in r244

PostPosted: Thu Jun 22, 2017 4:04 pm
by Ashley
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.