Skip to content

Instantly share code, notes, and snippets.

@MCarlomagno
Created September 25, 2020 16:27
Show Gist options
  • Save MCarlomagno/f8b13aca514f0b0c3b030f38940dfa4d to your computer and use it in GitHub Desktop.
Save MCarlomagno/f8b13aca514f0b0c3b030f38940dfa4d to your computer and use it in GitHub Desktop.
// right and left wrists are the objects given by the model
const rx = rightWrist.position.x;
const ry = rightWrist.position.y;
const lx = leftWrist.position.x;
const ly = leftWrist.position.y;
// vertical and horizontal distance
var dy = ly - ry;
var dx = lx - rx;
var theta = Math.atan2(dy, dx); // range (-PI, PI]
alpha *= -180 / Math.PI; // rads to degs, range (-180, 180]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment