Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- DynamicModule[{i, pos10 = {{}, {}}, pos11 = {{0, 0, 0}, {0, 0, 0}},
- pos12 = {{0, 0, 0}, {0, 0, 0}}, pos20,
- pos21 = {{0, 0, 0}, {0, 0, 0}}, pos22 = {{0, 0, 0}, {0, 0, 0}}},
- Graphics3D[{
- For[i = 1, i <= 2, i++,
- Print[i];
- EventHandler[
- Dynamic[{Translate[Cuboid[], pos11][[i]]},
- ImageSize ->
- Tiny], {"MouseDown" :> {(pos10[[i]] =
- Mean@MousePosition["Graphics3DBoxIntercepts"])},
- "MouseDragged" :> (pos11[[i]] =
- pos12[[i]] + Mean@MousePosition["Graphics3DBoxIntercepts"] -
- pos10[[i]]), "MouseUp" :> (pos12 = pos11)}];
- ]},
- PlotRange -> {{-3, 3}, {-3, 3}, {-3, 3}}]]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement