Quantcast
Channel: AR/VR (XR) Discussion
Viewing all articles
Browse latest Browse all 12131

Object following the camera with current coordinates as middle point to rotate around.

$
0
0
Hi guys,

I'm using Vuforia tags to (virtually) load a cube that follows the camera using the following (javascript) script:

Code (csharp):
  1.  var target : Camera;
  2.  
  3.  
  4. function Update() {
  5.    
  6.     var n = target.transform.position - transform.position;
  7.     transform.rotation = Quaternion.LookRotation(n) * Quaternion.Euler(0, 0, 0);
  8.     transform.eulerAngles.z = 0;
  9.  
  10. }
this works perfectly well if the middle point of the tag and the cube are alligned. However I want the cube to rotate around...

Object following the camera with current coordinates as middle point to rotate around.

Viewing all articles
Browse latest Browse all 12131

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>