Posted By

allnatural on 03/30/09


Tagged

control mouse Papervision3D papervision pv3d tilt tiltviewer


Versions (?)

Who likes this?

4 people have marked this snippet as a favorite

Pingpongbal
Akuma99
centurion09
davidino1978


Papervision3D - TiltViewer Style Mouse Interactions


 / Published in: ActionScript 3
 

URL: http://www.destroyyourcomputer.com

Control your objects via mouse similar to AirtightInteractive's TiltViewer

  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;

Report this snippet  

You need to login to post a comment.