Skip to content

Rotation sync does not work properly #2

@kamend

Description

@kamend

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]
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions