gamepad graphics
- To: mathgroup at smc.vnet.net
- Subject: [mg79816] gamepad graphics
- From: zzzz <giarc54 at gmail.com>
- Date: Sun, 5 Aug 2007 04:56:23 -0400 (EDT)
I wrote a program that is supposed to use my Logitech gamepad (for ps3) to control a point so that as it aproaches a disk, the hue of the disk will change. Curiously,(to me anyway) this programs works (kind of) only when a print command is inserted as below: DynamicModule[{x = -400, y = -400, d = 1000, a = .5}, ControllerManipulate[ Graphics[{{Hue[Dynamic[a]], Disk[{0, 0}, 200]}, {PointSize[Large], Point[{x, y}]}}, Axes -> True, PlotRange -> 1000, AspectRatio -> 1/1, ImageSize -> {500, 500}], Dynamic[x = x + ControllerState["Z1"]], Dynamic[y = y + ControllerState["Y2"]], Dynamic[d = Sqrt[Abs[((x - 0)^2) + ((y - 0)^2)] ] ] , Dynamic[a = (N[Dynamic[d]/1000])], (* Print[] *) "Z1" -> {x, -1000, 1000, .01}, "Y2" -> {y, -1000, 1000, .01}, ControllerMethod -> "None"]] When I remove the comment parentheses and asterix, it works,,,slowly. If I leave the them, the disk won't change color. How can I implement this better?Correctly? Please Help. I have a similar problem in 3D Below: DynamicModule[{x = 900, y = 900, z = 900, d = 0.00, p = 1.3, q = -2.4, r = 2, a = 1}, ControllerManipulate[ Dynamic[ Graphics3D[{PointSize[Large], Hue[Dynamic[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 -> {p, q, r}]], Dynamic[ d = Sqrt[((Dynamic[x] - 0)^2) + ((Dynamic[y] - 0)^2) + ((Dynamic[z] - 0)^2)] ], Dynamic[a = (N[Dynamic[d]/1000])], Dynamic[z = z + ControllerState["Y1"]], Dynamic[x = x + ControllerState["Z1"]], Dynamic[y = y + ControllerState["Y2"]], Dynamic[p = p + ControllerState["X3"]], Dynamic[q = q + ControllerState["Y3"]], (*Print[], *) "Y3" -> {q, -10, 10, .00001}, "X3" -> {p, -10, 10, .00001}, "Y1" -> {z, -1000, 1000, .01}, "Z1" -> {x, -1000, 1000, .01}, "Y2" -> {y, -1000, 1000, .01}, ControllerMethod -> "None", TrackedSymbols -> All] ] Gratefull for any help!
- Follow-Ups:
- Re: gamepad graphics
- From: Murray Eisenberg <murray@math.umass.edu>
- Re: gamepad graphics