Advertisement
Guest User

Untitled

a guest
Nov 24th, 2014
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. DynamicModule[{i, pos10 = {{}, {}}, pos11 = {{0, 0, 0}, {0, 0, 0}},
  2. pos12 = {{0, 0, 0}, {0, 0, 0}}, pos20,
  3. pos21 = {{0, 0, 0}, {0, 0, 0}}, pos22 = {{0, 0, 0}, {0, 0, 0}}},
  4. Graphics3D[{
  5.  
  6. For[i = 1, i <= 2, i++,
  7. Print[i];
  8. EventHandler[
  9. Dynamic[{Translate[Cuboid[], pos11][[i]]},
  10. ImageSize ->
  11. Tiny], {"MouseDown" :> {(pos10[[i]] =
  12. Mean@MousePosition["Graphics3DBoxIntercepts"])},
  13. "MouseDragged" :> (pos11[[i]] =
  14. pos12[[i]] + Mean@MousePosition["Graphics3DBoxIntercepts"] -
  15. pos10[[i]]), "MouseUp" :> (pos12 = pos11)}];
  16. ]},
  17. PlotRange -> {{-3, 3}, {-3, 3}, {-3, 3}}]]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement