What I'm trying to accomplish I think is fairly simple I just can't seem to wrap my head around how exactly...
I'm using a Kinect to track the center point of a person's body (x,y,z coordinates) and I need to write a function that knows when they are moving vs when they stop moving. So anytime there is change to the x,y,z coordinates.
What would be the most straightforward way to achieve this?
So I've been working with the SimpleOpenNI and Toxiclibs library for some time now to create an interactive audio environment as my final projects in University.
However my issue with Toxiclibs is you can only hear a sound when you are super close to it. Are there any other libraries or a work around with Toxiclibs to help get further range on sound sources?
What I basically want is to have a few different states controlled by three keys m, k, and q.
So if 'm' is pressed it would bring the program into 1st state. If 'k' is pressed 2nd state. if 'q' pressed 3rd state.
Once one of the above states is chosen (let's say 1st state) the user would have another opportunity to choose m, k, or q within that state. So 1st state + m = do this, 1st state + k = do something else, and 1st state + q = do another thing.
The issue I'm running into is if m is pressed at all the program doesn't remember if it's already in the 1st state so it will just start over and go back into 1st state instead of doing the second request. Here is what my code looks like but 1st, 2nd and 3rd states are defined as Forward, Left and Right.
int gameState; int FORWARD = 0; //int 1left = 1; //int 1right = 2;
I'm wondering is there a way for the program to remember it's already in a state or possibly counting the keyPresses?? So if m is pressed once do this if m is pressed twice do this?
This is the base code for a four way pong game my group and I are trying to create. So that four different players can play over a network. What we need is for the ball to bounce off of all four paddles. I know there are collision detection examples on Processing.org but for the sake of this program I'm wondering is it possible to create collision detection using color?
So for example: When white (255) hits grey (100) go the other direction.
Is there a simple way of implementing this?
// CLIENT
/* This sketch includes update on gamestates as well as the boolean
intersection to read whether the ball has hit the object.
Needs to be added: the ball hitting the player... if successful, it
should read in println "hit"and score will be added.
*/
import processing.net.*;
int gameState;
int INTRO = 0;
int GAME = 1;
int GAME_OVER = 2;
player1 = new Player(50, 250, 25, 70);
player2 = new Player(500, 250, 25, 70);
player3 = new Player(250, 500, 70, 25);
player4 = new Player(250, 50, 70, 25);
// ball = new Ball[1];
ball = new Ball(50, 50);
// Connect to the server's IP address and port
//client = new Client(this, "127.0.0.1", 12345); // Replace with your server's IP and port
client = new Client(this, "99.236.62.214", 12345); // Replace with your server's IP and port
noStroke();
/*BALL
frameRate(30);
smooth();
// Set the starting position of the shape
xpos = width/2;
ypos = height/2; */
//Here we would need to include else if (mousePressed == true && (CO-ORDINATES FOR OTHER PADDLE)
ball.display();
// for (int k = 0; k < i; k++) {
// ball[k].display();
// }
// Receive data from server
while (client.available() > 0) {
input = client.readStringUntil('\n');
println(input);
if (input != null) {
input = input.substring(0, input.indexOf("\n")); // Only up to the newline
data = int(split(input, ' ')); // Split values into an array
// Draw line using received coords
switch (data[0])
{
case 1:
player1.xPos = data[1];
player1.yPos = data[2];
break;
case 2:
player2.xPos = data[1];
player2.yPos = data[2];
break;
case 3:
player3.xPos = data[1];
player3.yPos = data[2];
break;
case 4:
player4.xPos = data[1];
player4.yPos = data[2];
break;
}
}
}
}
The problem is my MacBook Pros sound card only supports left to right panning and it has been the most impossible search finding a sound card that works with it. I need 3D audio capabilities. I've tried two of Creative's newest versions (yes I know they're for windows but I've heard they work) they do play audio through them but do not fix the issues within my program.
Can anyone recommend something? Thank you in advance!
Please can you help me determine why this code keeps giving me null errors? It displays all the images one by one but then it errors once it reaches the end of the array. Why doesn't it continue to loop?
int maxImages = 24;
int imageIndex = 0;
PImage[] images = new PImage[maxImages];
String api = "http://api.flickr.com/services/rest/?method=flickr.tags.getClusterPhotos&";
void setup() {
size(500, 500);
//text - Free text search. Searches the title, description or tags that contain this text.
//page - Which page of results you want returned
//per_page - Number of photos to return per page
//api_key - Required to access API
String query = api + "tag=monkey&cluster_id=1&format=rest&extras=url_o&api_key=bd7435660785b923332b224789d33c93";
println("Our final query URL:" + query);
println("**********************");
XMLElement xml = new XMLElement(this, query);
println(xml);
XMLElement[] photoTag = xml.getChildren("photos/photo");
for (int i = 0; i < photoTag.length; i++) {
//println(displayPhoto);
The XML file for Flickr search results doesn't actually display the url with the .jpg name in it - so I'm a little confused at how to get the image to display in Processing. Usually you can just get.Children but again the XML doesn't display the full url for an image. Here's my code so far...
PImage img;
String api = "http://api.flickr.com/services/rest/?method=flickr.tags.getClusterPhotos&";
//text - Free text search. Searches the title, description or tags that contain this text.
//page - Which page of results you want returned
//per_page - Number of photos to return per page
//api_key - Required to access API
String query = api + "text=cat&per_page=50&api_key=bd7435660785b923332b224789d33c93";
println("Our final query URL:" + query);
println("**********************");
XMLElement xml = new XMLElement(this, query);
XMLElement displayPhoto = xml.getChild("photos/photo");
I've been trying to use the Tweet Stream library for processing to track keywords that are tweeted by a specific user. Is this possible and am I using the right library? I'm a bit new to Processing so I'm sure it's a simple solution and I'm just not getting it. Any similar projects or any idea where to start with the code for this?