title: Inverting rotation in 3D, to make an object always face the camera?
body: <p>i have lots of sprites arranged in 3D space, and their parent container has rotations applied.
  How do i reverse the sprites 3D rotation, that they always face the camera (Actionscript 3)?</p>
  
  <p>heres a code to test it:</p>
  
  <pre><code>package{
  import flash.display.Sprite;
  import flash.events.Event;
  public class test extends Sprite{
  
  var canvas:Sprite = new Sprite();
  var sprites:Array = []
  
  public function test(){
      addChild(canvas)
      for (var i:int=0;i&lt;20;i++){
          var sp:Sprite = new Sprite();
          canvas.addChild(sp);
          sp.graphics.beginFill(0xFF0000);
          sp.graphics.drawCircle(0,0,4);
          sp.x = Math.random()*400-200;
          sp.y = Math.random()*400-200;
          sp.z = Math.random()*400-200;
          sprites.push(sp);
      }
      addEventListener(Event.ENTER_FRAME,function():void{
          canvas.rotationX++;
          canvas.rotationY = canvas.rotationY+Math.random()*2;
          canvas.rotationZ++;
          for (var i:int=0;i&lt;20;i++){
              //this is not working...
              sprites[i].rotationX = -canvas.rotationX
              sprites[i].rotationY = -canvas.rotationY
              sprites[i].rotationZ = -canvas.rotationZ
          }
      })
  }
  }
  }
  </code></pre>
  
  <p>I am guessing i have to do some magic with the rotation3D matrices of the sprites...
  I've tried to implement this script: <a href="http://ughzoid.wordpress.com/2011/02/03/papervision3d-sprite3d/">http://ughzoid.wordpress.com/2011/02/03/papervision3d-sprite3d/</a> , but had so success<br>
  Thanks for help.</p>