I'm quite new to Processing and i'm just trying to get my head around a few things
Fairly simple question i'm hoping, this is some collision code made by Keith Peters and it's included in the examples under 'bouncing bubbles'. Can anybody simply explain to me in Layman's terms how the collision method works?
class Ball { // creates ball class
float x, y;
float diameter;
float vx = 0; // sets starting velocity of x position of moving ball
float vy = 0; // sets starting velocity of y position of moving ball
Hi, basically i have a programmed an App that is essentially 2 balls, one is controlled by the mouse and is used to 'bounce' the other around the window.
Essentially i'm wondering if anybody can help me to implement vectors in my code as I've heard it's a better way to do this kind of thing, and it cleans up the code, but I've never used it and am having trouble understanding how to do it.
anyway here is the code;
float bx;
float by;
int ballSize = 20;
int ballSize2 = 40;
int m;
boolean bover = true;
boolean locked = false;
float xOffset = 0.0;
float yOffset = 0.0;
int numBalls = 2;
float spring = 0.05;
float friction = -0.4;
Ball[] balls = new Ball[numBalls];
void setup() {
size (640,600);
bx = height/2;
by = width/2;
stroke(0);
background(120);
noStroke();
smooth();
balls[0] = new Ball(300, 205, height/8, 0, balls);
balls[1] = new Ball(bx, by, height/7, 1, balls);
fill(0);
}
void draw()
{
background(0);
for (int i = 0; i < numBalls; i++) {
balls[i].collide();
balls[i].move();
balls[i].display();
}
balls[0].x = mouseX+5;
balls[0].y = mouseY+5;
if (mouseX > bx-ballSize && mouseX < bx+ballSize &&
I'm quite new to processing and pure data (pd) at the moment.
Currently I have pd receiving OSC messages on port 5001 from Processing, the problem is is that i can't seem to make the messages trigger an oscillator, or anything for that matter.
What is the problem? I'm a bit unfamiliar with the OSC protocol in general, is it a problem with the messages I'm sending in Processing or is it a pd problem?
I sometimes get an error in pd saying "error; trigger can only convert 's' to 'b' or 'a'". I'm just so confused!
I'm making a generative music application using Processing and Pure Data. I was wondering if any body could help me. My question is this.......
I have made an application in processing that is essentially two balls (Ball_1 and Ball_2) in a window; the user controls one of these balls (Ball_1) to bounce the second ball (Ball_2) around the sketch window. What I want to do is to send an OSC message to Pure Data every time one of the balls hits the sides of the window. Is it possible to do this, and, if so, how could I go about it?
I'm currently using processing to make the visual part of a generative music app that i later hope to combine with an audio engine in Puredata.
I'm relatively new to Processing but I was wondering if anybody knew how I would get it so that I could control a ball with my mouse to collide with a smaller ball and 'bounce' this around the screen?
Also if any body knows how I would them implement a patch in Puredata to then respond to the balls collisions it would be greatly appreciated.