4 ms·
I think if you know to search the keywords "inverse kinematics" and a bit of JS, this problem isn't too difficult, although I did bungle the signs in a few plac
by daemonologist 2y ago
I think if you know to search the keywords "inverse kinematics" and a bit of JS, this problem isn't too difficult, although I did bungle the signs in a few places. Someone (more dedicated than I) could also work out the trig from scratch if they didn't have that keyword.
Here's a solution: https://editor.p5js.org/jwlarocque/sketches/5tCufh3nw https://editor.p5js.org/jwlarocque/sketches/5tCufh3nw
- logicallee 2y agoThank you, great solution. It matches the spirit of the contest as well. If you want another challenge, you could try to get to that result by doing the equivalent of sending keypresses, further mimicking how a robot works. (You can just copy and paste the keys the keyPressed function calls and check the distances yourself). const angleIncrement = PI / 36; if (key === 'q') { upperArmAngle -= angleIncrement; moves++; } if (key === 'w') { upperArmAngle += angleIncrement; moves++; } if (key === 'a') { lowerArmAngle -= angleIncrement; moves++; } if (key === 's') { lowerArmAngle += angleIncrement; moves++; } if (key === 'g') grab(); // Grab the fruit if (key === 'r') release(); // Release the fruit What order of these statements would you send to get to the fruit, grab it, and then get to the result you show? Good job on completing the contest.
- logicallee 2y agoHere's the code with keypresses being sent: https://editor.p5js.org/robss2020/sketches/46cRgGQtX https://editor.p5js.org/robss2020/sketches/46cRgGQtX