Use Accelerometer Real ball rolling
themagicbox
Member, PRO Posts: 82
This is an old post i found and when i tried it out, it didnt work...It just stayed in the same placed no matter how much i tilted the device..im testing it on android adhoc..
this is the post
https://forums.gamesalad.com/discussion/4645/use-accelerometer-real-ball-rolling
has something changed?
is there another way to achieve this? i would like the ball on screen to act like it was a real ball...so if you were to to tilt it a lot, it would move faster. like the ball in the labyrinth games.. it would also be colliding with walls and stuff.
this is the post
https://forums.gamesalad.com/discussion/4645/use-accelerometer-real-ball-rolling
has something changed?
is there another way to achieve this? i would like the ball on screen to act like it was a real ball...so if you were to to tilt it a lot, it would move faster. like the ball in the labyrinth games.. it would also be colliding with walls and stuff.
Comments
Here's a project file for you I just whipped up. This method takes the Accelerometer X & Y raw input data, applies a low pass filter to smooth things out, is then multiplied and inserted into the scene gravity.
There is three balls of different sizes in the scene. The heaviness effect is controlled by the drag attribute of each ball. Applying more drag simulates a heavier object, increases dead zone and smoothness; but, decreases accuracy and responsiveness.
See scene > gravity actor for filter function. If you're interested in understanding how that works, Google: low pass filter accelerometer.
Post if you have any questions. Hope this helps you out, good luck!
https://dl.dropboxusercontent.com/u/27937751/gs/modules/BallsTableTilt_05_23_2013.gameproj.zip