General

Using accelerometer to control multiball so it bounces?

Started by fourier on .

Sign in or create an account to join the conversation.

15 posts

Topic starter
Hi there,

I have a question regarding the accelerometer in combination with multiball.

I would like to control the multiball using the accelerometer in such a way that it if you tilt your iPad/iPhone the ball falls to the specific side of the screen in a straight line. However...I would like it to bounce to the side as if it hits the floor like a ping pong ball. If you tilt the iPad/iPhone to the other side the ball should follow.

At this moment I have the ball following the accelerometer using this script:

y=(accelerometer[0]*-1+1)/2;
x=(accelerometer[1]+1)/2;

But it doesn't bounce yet. Any ideas on how I could accomplice this?

Thanx!

Fourier
that's a funny idea, but I believe this is not the way these elements are intended to use. Both multiball and accelerometer are input devices, separate input devices. They are here to use for a certain purpose, not to control each other. I understand the fun in moving the balls with the movement of the iPad, but I think you are missing the true purpose of those elements.

A ball moving along the physical movement of an iPad makes the ball an output device, which it isn't. Excuse my horrible English, but do you get my idea?
Phil999 wrote:that's a funny idea, but I believe this is not the way these elements are intended to use. Both multiball and accelerometer are input devices, separate input devices. They are here to use for a certain purpose, not to control each other. I understand the fun in moving the balls with the movement of the iPad, but I think you are missing the true purpose of those elements.

A ball moving along the physical movement of an iPad makes the ball an output device, which it isn't. Excuse my horrible English, but do you get my idea?
Hi Phil,

I understand what you mean. It would be great if the Multiball object could be controlled via OSC so I can do the scripting on the computer. I have a script that does it for my Monome 64 which has also an accelerometer.

I guess I need to do some rethinking.
Well you can control the Multiball from the outside, by sending it /Multiball/x and /Multiball/y messages.
You could also simulate some physics using the accelerometer in the script engine, I'll try to come up with an example for you.
fourier wrote:
studioda wrote:and what about accelerometer[2] ?
What do you mean?
I notice that all template which use accelerometer ,utilise only accelerometer[0] and accelerometer[1] but why not accelerometer[2]?
Since the accelerometer has only 3 parameters (x,y and z) I guess you need to give them a number. You could try to change the number and see if it still works (OSC). I just copied the code from the forum over here.
axel_liine wrote:A short one as promised. Will make it more customizeable for the User Lib.
great! I like it a lot. Don't know yet a real application for it, but it's beautiful. Maybe for a Pong game?

I usually have my iPad stationary, but this accelerometer input is quite accurate and usable. Giving us some ideas for probable applications. I like to use Lemur/iPad in a live situation, and turning and twisting this thing might be something that adds to the experience. I'm rather new to this thing, only three weeks with the iPad. I like it.
I am going to try this out in my Moog Little Phatty template, I would like to have this as a script attached to a row of switch objects (4 switches) to control the routing to the multiball objects on and off, (to be able to turn accelerometer control on and off individually for each multiball or X/Y pad as I am using them.)
Can you scripting geniuses help with that?
so, i have been pushing this through my head over and over and while no closer to implementing this into my Little Phatty controller, (with switches to turn on and off) I have been thinking about use as a sequencer with a breakpoint object, to have the balls/points work as note on with the bottom being pitch scaled left to right, so have points "spawn" near the top, be able to bounce off walls (and other points?) and slide down to trigger notes as the hit the bottom and disappear to be re-spawned and repeat, friction/speed ruled by tilt of iPad. also a control to determine the number of points/balls/notes.... Call it Rain