Advertise Books Events Forum News Social Networking Support Us

sdkIQ for iPhone
($4.99)

Shape Up
($0.99)

Your First iPhone App
($1.99)

iVidCam Free
(free)

Kid Art
($0.99)

iPUBQUIZ
(£1.19)

ArtStudio
($3.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 10-01-2008, 04:44 PM   #1 (permalink)
Registered Member
 
scotopia's Avatar
 
Join Date: Oct 2008
Posts: 1,661
Default 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!
scotopia is offline   Reply With Quote
Old 10-02-2008, 09:14 AM   #2 (permalink)
Registered Member
 
scotopia's Avatar
 
Join Date: Oct 2008
Posts: 1,661
Default

Anyone interested?
scotopia is offline   Reply With Quote
Old 10-02-2008, 09:31 AM   #3 (permalink)
New Member
 
Join Date: Sep 2008
Posts: 279
Default

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.
Kenrik is offline   Reply With Quote
Old 10-02-2008, 09:32 AM   #4 (permalink)
Magic Hands' Daddy
 
Join Date: Aug 2008
Location: Memphis, TN, USA
Age: 22
Posts: 1,372
Send a message via ICQ to smithdale87 Send a message via AIM to smithdale87 Send a message via Skype™ to smithdale87
Default

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 ?
smithdale87 is offline   Reply With Quote
Old 10-02-2008, 10:16 AM   #5 (permalink)
Registered Member
 
scotopia's Avatar
 
Join Date: Oct 2008
Posts: 1,661
Default

@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.
scotopia is offline   Reply With Quote
Old 10-02-2008, 10:23 AM   #6 (permalink)
Magic Hands' Daddy
 
Join Date: Aug 2008
Location: Memphis, TN, USA
Age: 22
Posts: 1,372
Send a message via ICQ to smithdale87 Send a message via AIM to smithdale87 Send a message via Skype™ to smithdale87
Default

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
smithdale87 is offline   Reply With Quote
Old 10-19-2008, 06:38 AM   #7 (permalink)
New Member
 
Join Date: Jul 2008
Posts: 41
Default

i am also interested in smoothing the accelerometer
it just dont look good when its not smooth
nambrot is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Enter the iPhone App Challenge!  Win $500!
» Advertisements
» Online Users: 272
16 members and 256 guests
adison, Bertrand21, bravetarget, falcon76, ForrestShi, iSdkDev, jordanclark1993, leeus, LemonMeringue, lepetitapps, ltgbau, pereorra, rajeshgautam, refreshe, Tambourin, warcrow
Most users ever online was 779, 05-11-2009 at 09:55 AM.
» Stats
Members: 24,226
Threads: 39,006
Posts: 171,094
Top Poster: smasher (2,570)
Welcome to our newest member, mellisakelien54
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 02:28 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0