Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- float repulsorAngle = atan2(repulsor.y, repulsor.x);
- if(rad < 0.0) { angle = map(rad, -PI, 0, 180, 360); }
- else { angle = map(rad, 0, PI, 0, 180); }
- float angleDist = abs(angle - repulsor.angle);
- float dist = PVector.dist(new PVector(x, y), new PVector(repulsor.x, repulsor.y));
- float inc = 45.0;
- if (angleDist < inc) {
- float sine = sin(map(angleDist, inc, 0, 0, PI / 2)) * 50.0;
- println(sine);
- x = cos(radians(angle)) * (r + sine * dir);
- y = sin(radians(angle)) * (r + sine * dir);
- } else {
- x = cos(radians(angle)) * (r);
- y = sin(radians(angle)) * (r);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement