Advertisement
Guest User

Untitled

a guest
Oct 27th, 2016
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. trackBallControls.noRotate = true;
  2. if (isDragging === true) {
  3. var deltaMove = {
  4. x: event.offsetX -previousMousePosition.x,
  5. y: event.offsetY -previousMousePosition.y
  6. };
  7. var deltaRotationQuaternion = new THREE.Quaternion()
  8. .setFromEuler(new THREE.Euler(toRadians(deltaMove.y * 0.3),
  9. toRadians(deltaMove.x * 0.3),
  10. 0,
  11. 'XYZ'
  12. ));
  13. if (event.which === 1) {
  14. mesh.quaternion.multiplyQuaternions(deltaRotationQuaternion, mesh.quaternion);
  15. }
  16. }
  17. previousMousePosition = {
  18. x: event.offsetX,
  19. y: event.offsetY
  20. };
  21.  
  22. function toRadians(angle) {
  23. return angle * (Math.PI / 180);
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement