Hi guys,
I’m using Vuforia tags to (virtually) load a cube that follows the camera using the following (javascript) script:
var target : Camera;
function Update() {
var n = target.transform.position - transform.position;
transform.rotation = Quaternion.LookRotation(n) * Quaternion.Euler(0, 0, 0);
transform.eulerAngles.z = 0;
}
this works perfectly well if the middle point of the tag and the cube are alligned. However I want the cube to rotate around its own center while the middle points of the tag and cube are NOT alligned.
Using this script, with unalligned middle points, the cube will turn around the middlepoint of the tag because the cube is a child of the tag.
Thus, my question: how can I make the cube follow the camera, while the centers of the tag and cube are not alligned and the cube is a child of the tag?
Hope everything is clear.
Thanks