Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rotation sync does not work properly #2

Open
kamend opened this issue May 29, 2020 · 0 comments
Open

Rotation sync does not work properly #2

kamend opened this issue May 29, 2020 · 0 comments

Comments

@kamend
Copy link

kamend commented May 29, 2020

For some reason Cannon's own toEuler() function does not work as expected, so I had to use the function from this issue: schteppe/cannon.js#211, in order to get the right rotation to use for the Spark Objects. I am using the latest Spark AR version, btw

function quatToVec3(x,y,z,w){
  var ax = Math.atan2(-2*y*z+2*x*w,1-2*x*x-2*y*y);
  var ay = Math.asin(2*x*z+2*y*w);
  var az = Math.atan2(-2*x*y+2*z*w,1-2*y*y-2*z*z);
  return [ax,ay,az]
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant