Touch.Alpha orientation

Bugs will be moved here once resolved.

Post » Sun May 14, 2017 2:27 pm

Problem Description
When using Touch.Alpha to rotate a sprite towards the ground in real life/ the center of the earth (img bellow to explain what I wanted to happen better), the outputed value from Touch.Alpha is not correct/ consistet.
Image
(Higher rezolution link: https://www.dropbox.com/s/237oi0dw8bp2g ... n.png?dl=0 )

This has happened on 3 phones from different brands.

Attach a Capx
https://www.dropbox.com/s/geeytfhct5juj ... .capx?dl=0
Apk files already packed: https://www.dropbox.com/s/h37dturxjtevi ... k.zip?dl=0

Description of Capx
Sets the angle of the sprite ("Circle") to the device's Touch.Alpha. The user can also add 0, 90, 180 or 270 extra degrees to the circle's angle by pressing the buttons at the bottom left of the view.

Steps to Reproduce Bug
  • Instalation: Open and install the .apk file that works based on your device's processor. if the device is based on an Intel processor, run the file that has "x86" in the title; if it is arm-based, run the file with "arm" in it's title.
    This can be determined by serching for the device's specifications, or It can also be found trough trial and error, as the wrong .apk file will not install.
    The device may prompt you to turn on unknown sources. It can be done from settings - security - unknown sources and is required for any .apk file that does not come from a known source (ex.
    Google Play).
  • Usage: Once the app is installed and opened, rotating the phone on the Z axis should rotate the sprite.
    If the ball is not orientated correctly, you can add an offset to it by pressing the buttons in the lower left corner.

Observed Result
The sprite rotates when the phone is rotated and points towards the ground irl when held vertically, but if the phone is laying on it's side (horizontally), or in any other orientation, the sprite does not point correctly.

Expected Result
When the phone would be tilted, the sprite would point downwards relative to the ground in real life (like in the images from above)

Affected Browsers
Not applicable, as it is a standalone application.

Operating System and Service Pack
Windows 10, service pac 0, I belive (In pc - properties, under windows version it only said "Windows 10 Pro")
Android V. 6 and 7 (Xperia z3 and Samsung S7)

Construct 2 Version ID
R244
ImageImageImageImage
B
30
S
9
G
7
Posts: 249
Reputation: 5,610

Post » Mon May 15, 2017 1:55 pm

Touch.Alpha gives the compass bearing, so you're using the wrong value here.
Scirra Founder
B
398
S
236
G
88
Posts: 24,433
Reputation: 194,635

Post » Mon May 15, 2017 2:54 pm

Ashley wrote:Touch.Alpha gives the compass bearing, so you're using the wrong value here.

Oh, sorry... Thought that would be the right one to use...

So, what expression would I need to use? I also tried Beta and Gama, but neither of them worked.
B
30
S
9
G
7
Posts: 249
Reputation: 5,610

Post » Sun May 21, 2017 8:38 pm

TRMG wrote:
Ashley wrote:Touch.Alpha gives the compass bearing, so you're using the wrong value here.

Oh, sorry... Thought that would be the right one to use...

So, what expression would I need to use? I also tried Beta and Gama, but neither of them worked.


Well, do you want just gravity, or do you want all acceleration?

With acceleration:
X = -Touch.AccelerationXWithG
Y = Touch.AccelerationYWithG
Just gravity:
X = -(Touch.AccelerationXWithG - Touch.AccelerationX)
Y = Touch.AccelerationYWithG - Touch.AccelerationY

Then:
Angle = angle(0, 0, X, Y)
B
54
S
19
G
13
Posts: 97
Reputation: 10,146

Post » Sun May 21, 2017 10:13 pm

Johncw87 wrote:Well, do you want just gravity, or do you want all acceleration?

With acceleration:
X = -Touch.AccelerationXWithG
Y = Touch.AccelerationYWithG
Just gravity:
X = -(Touch.AccelerationXWithG - Touch.AccelerationX)
Y = Touch.AccelerationYWithG - Touch.AccelerationY

Then:
Angle = angle(0, 0, X, Y)

Oh my gawd! Thank you so much!
I've been trying to switch to Unity in order to get this to work, but you saved me a lot of hassle!
ImageImageImageImage
B
30
S
9
G
7
Posts: 249
Reputation: 5,610

Post » Thu Jun 22, 2017 3:47 pm

Closing as not a bug.
Scirra Founder
B
398
S
236
G
88
Posts: 24,433
Reputation: 194,635


Return to Closed bugs

Who is online

Users browsing this forum: No registered users and 2 guests