 |
 |
|
 |
10-01-2008, 05:44 PM
|
#1 (permalink)
|
|
Registered Member
Join Date: Oct 2008
Posts: 1,556
|
Refining the motion of a ball's movement based on accelerometer
Hello All,
I have found a good tutorial on the subject of making a ball move based on the accelerometer:
Exploring iPhone Graphics Part 3 | Trails in the Sand
but the motion of the ball does not look nearly as smooth as other apps I have seen (Labyrinth is the best example).
I suspect there are all sorts of smoothing algorithms and the like involved. Now that the NDA is lifted I would like us all to put our heads together to make a really nice core engine for object motion based on the iphones tilt.
To get a truly accurate scenario we would I imagine have to be constantly doing something like this with each tick of the accelerometer:
1) get the ball's current velocity and break it into its component vectors along the axes (that's plural of axis right?  )
2) get the current accelerometer values over the last time interval
3) break that acceleration into it's component vectors along the axes
4) apply this acceleration to get the new velocity along the axes
5) add these component vectors to get the ball's new velocity and movement on the screen
Does this sound about right?
Here are some links to get us thinking in the right place:
Equations of motion - Wikipedia, the free encyclopedia
Classical mechanics - Wikipedia, the free encyclopedia
Eventually I would like to go even further to get some simplistic but accurate physics going on for collisions and the like, but first things first.
Let's see what we can come up with. Thanks!
|
|
|
10-02-2008, 10:14 AM
|
#2 (permalink)
|
|
Registered Member
Join Date: Oct 2008
Posts: 1,556
|
Anyone interested?
|
|
|
10-02-2008, 10:31 AM
|
#3 (permalink)
|
|
New Member
Join Date: Sep 2008
Posts: 279
|
Or you can just turn up the refresh rate...
look at the bubble level app. it has everything defined and you can just play with the numbers to get your desired effect.
|
|
|
10-02-2008, 10:32 AM
|
#4 (permalink)
|
|
Magic Hands' Daddy
Join Date: Aug 2008
Location: Memphis, TN, USA
Age: 22
Posts: 1,245
|
In Apples CrashLanding sample code, they use a low-pass filter to stabilize the accelerometer readings.. maybe this will help you in getting a smoother ball motion, rather than using equations of motion, etc ?
|
|
|
10-02-2008, 11:16 AM
|
#5 (permalink)
|
|
Registered Member
Join Date: Oct 2008
Posts: 1,556
|
@Kenrik:
That doesn't do the trick; it still doesn't look natural at all. I played with a variety of values for several hours and found certain configurations that kinda work, but still not well.
@smithdale87:
Actually if you REMOVE the low pass filter the movement of the ball is much smoother and more responsive (with the trade off of more than just tilt affecting it).
I am not interested in a short cut here. I think it is more than doable to achieve realistic physics here with not too much code. I can do it myself (was a physics professor back in the day) but would appreciate some code help if possible. Thanks all.
|
|
|
10-02-2008, 11:23 AM
|
#6 (permalink)
|
|
Magic Hands' Daddy
Join Date: Aug 2008
Location: Memphis, TN, USA
Age: 22
Posts: 1,245
|
I see I see
It's obvious that I'm not a physics expert :-)
I'd love to help, unfortunately I dont have the time. 3 jobs and school take about every second of my time away from me!
Good luck though, and I'm definitely interested in the final result
|
|
|
10-19-2008, 07:38 AM
|
#7 (permalink)
|
|
New Member
Join Date: Jul 2008
Posts: 41
|
i am also interested in smoothing the accelerometer
it just dont look good when its not smooth
|
|
|
 |
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
» Advertisements |
» Online Users: 456 |
| 53 members and 403 guests |
| !_UK@$, acerola, aryaxt, bbc z, BrianSlick, Chris Stewart, coolman, CoxTral, cphilc, CunningCat, dany88, darage, dcinqc, DenVog, endy13, falcon76, ggalante, Gudus, iPhoneDevelopment, JHawk1, jingledale, jj0b, joelm, josep@sixtemia.com, Kroupy, Kryckter, kyeck, lanej, lukeca, LunarMoon, mlfarrell, nDev1, NicolasD, nobre84, NSeven, P2k, PeddlePower, pereorra, Pring, ryguy2503, scribouillard, sennah, shay_somech, sjurmr, smasher, StevenD, TapTouchClick, thewitt, treazer, VanCrey, xyster, ZunePod |
| Most users ever online was 779, 05-11-2009 at 10:55 AM. |
» Stats |
Members: 21,500
Threads: 35,780
Posts: 156,758
Top Poster: smasher (2,449)
|
| Welcome to our newest member, VanCrey |
|