• this is the simplest code that I am using:

    var Vec3 = require("Vec3");
    var vmin = new Vec3(Puck.mag());
    var vmax = vmin;
    function onMag(xyz) {
      vmin = vmin.min(xyz);
     vmax = vmax.max(xyz);
     var c = vmin.add(vmax).mul(0.5).sub(xyz); 
     var a = (Math.atan2(c.x,c.y)*180/Math.PI);
    if(a <0) a+=360;
      
        console.log( vmin);
        console.log( vmax);
       console.log( c);
        console.log( a.toFixed(0) );
    }
    Puck.on('mag', onMag);
    Puck.magOn(10);
    

    I get consistent 0 to 360 degree measurements, but with 0 to 270 actually between 0 and 350 and 270 to 360 occuring in the last 10 degrees.

About

Avatar for user158028 @user158028 started