WalkVect ofApp::createWalkVect(ofPoint velocity, ofPoint vector, IsLine line) { ofPoint dir = vector.normalize(); if(velocity.y < 0) dir *= -1; WalkVect vect; vect.dir = dir; vect.spd = velocity.length(); vect.line = line; return vect; }
void ofApp::update(){ mouse = ofPoint(mouseX, mouseY); mouse -= center; m = mouse.length(); cout << m << " is the magnitude of m" <<endl; //unit vectors mouse.normalize(); mouse*=50; }
void update(){ Hands= ofPoint(x,y); //location of the hands in the air ( ir sensors) dir= ofPoint(Hands - location); dir.normalize(); dir *=0.01; accel= dir; velocity += accel; //speed location += velocity; // where is + the movement speed velocity.limit(maxspeed); //verctor doesnt get bigger then 3 //collision target if(ofDist(Target.x,Target.y, location.x, location.y)<rectSize){ points ++; Target=ofPoint(ofRandom(20,ofGetWidth()-20), ofRandom(20,ofGetHeight()-20)); hitsound.play(); } }