Mathematica 9 is now available
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: [mg79862] Re: gamepad graphics
  • From: zzzz <giarc54 at gmail.com>
  • Date: Tue, 7 Aug 2007 01:30:20 -0400 (EDT)
  • References: <200708050856.EAA22603@smc.vnet.net><f96jqe$qg3$1@smc.vnet.net>

On Aug 6, 12:49 am, Murray Eisenberg <mur... at math.umass.edu> wrote:
> 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                     mur... 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

Thanks Murray, Yeah, I know the Print statement is wrong. But Why must
it be there in order
for the color of the disk (or sphere in 3d ) to change color as a
function of the distance??
How can I get the program to work without the Print statement?( comma
aside)
Thanks for your time.



  • Prev by Date: RE: Using ShowLegend
  • Next by Date: Re: Working with factors of triangular numbers.
  • Previous by thread: Re: gamepad graphics
  • Next by thread: Cube codes just done in Mathematica