Do You Know?
- To: mathgroup at smc.vnet.net
- Subject: [mg80404] Do You Know?
- From: zzzz <giarc54 at gmail.com>
- Date: Tue, 21 Aug 2007 05:07:51 -0400 (EDT)
When I run the program below,using Manipulate, The larger sphere will change color depending on the distance to the smaller sphere.However, when I use ControllerManipulate, this color change does not occur.This behavior happens after Mathematica ceases to indicate that the program is running.Shouldn't the program be running for the sliders and the gamepad to affect the Graphics? Hey, I wouldn't care if only the program would change the color of the sphere in the intended way while using my gamepad(Logitech cordless precision forPS3).I have been leaving the wireless reciever pluged into the usb port while trying to run both versions.How can I rewrite this program so that the color change happens using the gamepad and ControllerManipulate? Here's the program... DynamicModule[{x = 900, y = 900, z = 900, d = 0.00, p = 1.3, q = -2.4, r = 2, a = .9, va = 90 Degree, k = 0}, Manipulate[ Dynamic[ Graphics3D[{PointSize[Large], Hue[a], Sphere[{0, 0, 0}, 200], {Hue[.8], Sphere[{x, y, z}, 50]}}, PlotRange -> 1050, AspectRatio -> Automatic, BoxRatios -> {1, 1, 1}, Axes -> True, ImageSize -> {600, 600}, ViewPoint -> {1.3 + k, -2.4 + k, 2}, ViewAngle -> Dynamic[Module[{q = ControllerState["X3"]}, If[Abs[q] > 0.2, va += q*0.005; va = Clip[va, {1 Degree, 179 Degree}]]; va]] ]], Dynamic[ d = N[Sqrt[((Dynamic[x] - 0)^2) + ((Dynamic[y] - 0)^2) + ((Dynamic[z] - 0)^2)], 3 ]], Dynamic[a = (N[Dynamic[d]/1000, 3])], Dynamic[z = z + ControllerState["Y1"]], Dynamic[x = x + ControllerState["Z1"]], Dynamic[ y = y + ControllerState["X1"], If[Abs[ControllerState["X1"]] > 0.2, y += ControllerState["X1"]*0.05; y = Clip[y, {-974, 974}]]; y] , (*Print[], *) "Y1" -> {z, -1000, 1000, .01}, "Z1" -> {x, -1000, 1000, .01}, "Y2" -> {y, -1000, 1000, .01}, "X3" -> {q, -3, 3, .001}, "Y3" -> {k, -2, 2, .000001}, TrackedSymbols -> {All}] ]