How can I set a dynamic global via a Locator
- To: mathgroup at smc.vnet.net
- Subject: [mg118636] How can I set a dynamic global via a Locator
- From: "Christopher O. Young" <cy56 at comcast.net>
- Date: Thu, 5 May 2011 05:24:24 -0400 (EDT)
Finally got the 3D point with its x and y locations controlled by the
draggable locator, and its z location controlled by the h slider.
For some reason, I need to apply Dynamic to r in the r-slider to get it to
set the radius of the sphere, whereas the h variable sets the height of the
3D point without needing to have Dynamic applied to it.
Dynamic[s]
Graphics[
Locator[Dynamic[s]],
PlotRange -> 2,
Frame -> True,
Axes -> True
]
Slider[Dynamic[h], {-2, 2, 0.25}]
Slider[Dynamic[r], {0, 0.5, 0.05}]
Dynamic[
Graphics3D[
Sphere[{s[[1]], s[[2]], h}, Dynamic[r]],
PlotRange -> 2,
Axes -> True
]
]