Papervision3D - TiltViewer Style Mouse Interactions


/ Published in: ActionScript 3
Save to your folder(s)

Control your objects via mouse similar to AirtightInteractive's TiltViewer


Copy this code and paste it in your HTML
  1. var ShiftY: Number = stage.stageWidth / 2;
  2. var ShiftX: Number = stage.stageHeight / 2;
  3.  
  4. // number @ the end (90) is the degree's to allow object to turn
  5. var rotationY: Number = -( (mouseX - ShiftY) / stage.stageWidth * 90);
  6. var rotationX: Number = -( (mouseY - ShiftX) / stage.stageHeight * 90);
  7.  
  8. // Replace _screenCube with the object you wish to control
  9. // Lower number = faster turns
  10. _screenCube.rotationY += (-rotationY - _screenCube.rotationY) / 12;
  11. _screenCube.rotationX += (rotationX - _screenCube.rotationX) / 12;

URL: http://www.destroyyourcomputer.com

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.