Page 1 of 2

Using accelerometer to control multiball so it bounces?

Posted: 27 Jan 2012 00:55
by fourier
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

Re: Using accelerometer to control multiball so it bounces?

Posted: 27 Jan 2012 03:38
by Phil999
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?

Re: Using accelerometer to control multiball so it bounces?

Posted: 27 Jan 2012 11:16
by studioda
H!,
I want to know which data five by accelerometer .
accelerometer[0]= what,accelerometer[1]= what ,accelerometer[2]= what ???
and is it possible to translate accelerometer in {x,y,z} ????

Re: Using accelerometer to control multiball so it bounces?

Posted: 27 Jan 2012 13:22
by fourier
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.

Re: Using accelerometer to control multiball so it bounces?

Posted: 27 Jan 2012 15:47
by axel_liine
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.

Re: Using accelerometer to control multiball so it bounces?

Posted: 27 Jan 2012 18:04
by axel_liine
A short one as promised. Will make it more customizeable for the User Lib.

Re: Using accelerometer to control multiball so it bounces?

Posted: 28 Jan 2012 17:22
by fourier
Hi Axel,

Thats great!!!! It works like I wanted. Only reversed but will fiddle around with the code.

Thanx a million. I don't think I could have done this in this short time.

Fourier

Re: Using accelerometer to control multiball so it bounces?

Posted: 28 Jan 2012 18:28
by studioda
and what about accelerometer[2] ?

Re: Using accelerometer to control multiball so it bounces?

Posted: 28 Jan 2012 18:55
by fourier
studioda wrote:and what about accelerometer[2] ?
What do you mean?

Re: Using accelerometer to control multiball so it bounces?

Posted: 29 Jan 2012 16:27
by studioda
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]?