How do I Shake (Acceleration) device for Trigger

Get help using Construct 2

Post » Wed Jun 08, 2016 3:03 pm

Hello,

I want to be able to shake my device to cause a trigger - for now, a simple Debug.Log will be fine.

I know I can access the acceleration of the device by Touch > Compare Acceleration. Any ideas how I can use this to detect a Device Shake?

Or is there's another plugin that can do this for me?

Thanks.
B
5
S
1
Posts: 15
Reputation: 349

Post » Thu Jun 09, 2016 10:10 am

** bump **
B
5
S
1
Posts: 15
Reputation: 349

Post » Fri Mar 31, 2017 10:39 pm

Hey Oliverj777,
i am searching for the same thing at the moment. What i googled was how this is usually done with a native Android programming.
So in theory what you need is something like:
remember all three axis (alpha,beta,gamma) and record the current time (timestamp).
Then add all axis value together minus the difference from the timestamp + the current time.
This result is like "how far have the axis travelled in time" :)

Here is the Android version:
http://stackoverflow.com/questions/2317 ... o-shake-it

My problem is that i am too dump to convert it to Construct 2 :D
B
6
S
1
G
1
Posts: 14
Reputation: 878


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 61 guests