1
$\begingroup$

I have plotted two graphs and I want these two to show together in one graph. But one graph is a rotating ball and the other is simply an arrow. This is the code:

Graphics3D[{Sphere[{0, 0, 0}, 1], Blue, Arrowheads[0.01], 
Arrow[Tube[{{0, -0.7, -1.5}, {0, -1.7, -2.5}}, 0.003]]}, 
 Boxed -> False, 
 Lighting -> {{"Directional", 
    RGBColor[0., 0.1, 0.01], {1, 0, 0}}, {"Directional", 
    RGBColor[0.605, 0.2, 0.1], {0.5, 0.5, 0}}, {"Directional", 
    RGBColor[0.61, 0.205, 0.1], {0, 1, 0}}, {"Directional", 
    RGBColor[0.615, 0.21, 0.1], {0.5, -0.5, 0}}, {"Directional", 
    RGBColor[0.62, 0.215, 0.1], {0, -1, 0}}, {"Directional", 
    RGBColor[0.625, 0.22, 0.1], {-0.5, -0.5, 0}}, {"Directional", 
    RGBColor[0.63, 0.225, 0.1], {0, -1, 0}}, {"Directional", 
    RGBColor[0.635, 0.23, 0.1], {0.5, -0.5, 0}}}, 
 ViewPoint -> 
  Dynamic[RotationTransform[Clock[{2 \[Pi], 0}, 5], {0, 0, 1}][{1, 0, 
     0}]], PlotRange -> 5, SphericalRegion -> True]

I don't want the arrow to rotate. Are there any ways?

$\endgroup$
  • $\begingroup$ The arrow isn't rotating, the viewpoint is rotating. Either make the sphere rotate, or make the arrow rotate along with the viewpoint. Either way, I'd prefer Animate[] over Dynamic. $\endgroup$ – Feyre Oct 31 '16 at 13:44
4
$\begingroup$

This gives the impression you wanted

Animate[Graphics3D[{Sphere[{0, 0, 0}, 1], Blue, Arrowheads[0.01], 
   Arrow[Tube[{{0, -0.7, -1.5}, {0, -1.7, -2.5}}, 0.003]]}, 
  Boxed -> False, 
  Lighting -> 
   Join[{{"Directional", 
      RGBColor[0., 0.1, 0.01], {Cos[θ], Sin[θ], 0}}}, 
    Table[{"Directional", 
      RGBColor[0.6 + 0.005 i, 0.2 + 0.05 i, 
       0.1], {Cos[θ + i π/4], Sin[θ + i π/4], 
       0}}, {i, 7}]]], {θ, 0, 2 Pi}]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.