Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2007
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: gamepad graphics

  • To: mathgroup at smc.vnet.net
  • Subject: [mg79841] Re: [mg79816] gamepad graphics
  • From: Murray Eisenberg <murray at math.umass.edu>
  • Date: Mon, 6 Aug 2007 03:41:15 -0400 (EDT)
  • Organization: Mathematics & Statistics, Univ. of Mass./Amherst
  • References: <200708050856.EAA22603@smc.vnet.net>
  • Reply-to: murray at math.umass.edu

Something is wrong in your code syntactically with the Print[] 
expression after you remove the comments around it (even after one 
inserts an apparently missing comma after Print[] in the 2D case).

zzzz wrote:
> 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!
> 
> 

-- 
Murray Eisenberg                     murray at math.umass.edu
Mathematics & Statistics Dept.
Lederle Graduate Research Tower      phone 413 549-1020 (H)
University of Massachusetts                413 545-2859 (W)
710 North Pleasant Street            fax   413 545-1801
Amherst, MA 01003-9305


  • Prev by Date: Re: Integro-differential analog of Love's equation via power series
  • Next by Date: Re: Documentation Center (v6): do-it-yourself Mathematica Book
  • Previous by thread: gamepad graphics
  • Next by thread: Re: gamepad graphics