In my app, I am trying to rotate an Object Group via Rotations I get from Device Orientation API.
At some point, I want to calibrate the rotation of my object so that it looks in the same direction as my camera. (having rotation values (0,0,0)! )
But since I am setting the objects rotation via
var euler = new THREE.Euler(x, y, z, 'ZXY'); // angles come from Device Orientation
this.object.setRotationFromEuler(euler);
my object always takes the absolute rotation of my device. For calibrating this, I want to set a rotation on my group and then 'apply' the rotation matrix to the group. Effectively setting it's rotation values x,y,z to 0 so I can set them again with absolute values but the group should rotate relative to the calibrated rotation.
I tried sth like this before, but as I my group doesn't have a geometry, it won't work. Do I have to traverse through every sub-object and apply the rotation to every geometry or is there any way to set a rotation state as 'base' for a group?
The only other solution I can think of is to save the current rotation values on calibrate request and always rotate relative to those, but It would be nice if there was such a method.