Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import processing.net.*;
- Client client;
- PVector pos, vel;
- void setup() {
- size(1000, 500);
- client = new Client(this, "192.168.0.206", 30002);
- float maxspeed = 5;
- pos = new PVector(width/2, height/2);
- vel = new PVector(random(-maxspeed,maxspeed), random(-maxspeed,maxspeed));
- client.write("movej(p[0,-0.5,0.5,0,2,-2])\n");
- delay(5000);
- }
- void draw() {
- background(0);
- pos.add(vel);
- if(pos.x > width || pos.x < 0) {
- vel.x *= -1;
- }
- if(pos.y > height || pos.y < 0) {
- vel.y *= -1;
- }
- noStroke();
- fill(255);
- circle(pos.x, pos.y, 40);
- float scale = 0.07;
- String msg = String.format("speedl([%.9s,0,%.9s,0,0,0], 0.5, 0.5)\n", vel.x*scale, -vel.y*scale);
- client.write(msg);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement