Google Cardboard support

Thanks for that! I managed to set an observer but I seemed to be getting an odd rotation and the camera wasn’t moving either.

I had a look in cardboard state and changed a couple of things - firstly I added a line to set the location of the observer to the world translation which put the camera in the right place.

Secondly I changed the order in which the quaternions are multiplied as the weird rotation was still there. I changed these around and this seemed to correct it. I’ve tested it both with an observer now and without and it seems to be ok. :slight_smile:

I’ve included the modified update method below if anyone else needs it:

    // left eye
    tempVars.quat1.set(context.getOrientation());

    tempVars.quat1.toAngles(tempAngles);
    tempAngles[0] = -tempAngles[0];
    tempAngles[2] = -tempAngles[2];
    tempVars.quat1.fromAngles(tempAngles);
    
    tempVars.tempMat4.set(context.getLeftEye().getEyeView());
    tempVars.tempMat4.toTranslationVector(tempVars.vect1);
    if(observer != null){
        tempVars.quat1.set(observer.getLocalRotation().multLocal(tempVars.quat1));
        tempVars.vect1.set(observer.getWorldTranslation());
    }
    camLeft.setFrame(tempVars.vect1, tempVars.quat1);
    
    // right eye
    tempVars.tempMat4.set(context.getRightEye().getEyeView());
    tempVars.tempMat4.toTranslationVector(tempVars.vect1);
    if(observer != null){
        tempVars.vect1.set(observer.getWorldTranslation());
    }
    camRight.setFrame(tempVars.vect1, tempVars.quat1);


    tempVars.release();