MathGroup Archive 2007

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

Search the Archive

Re: 3D manipulation with gamepad in V6

  • To: mathgroup at
  • Subject: [mg77449] Re: [mg77418] 3D manipulation with gamepad in V6
  • From: Chris Hill <chill at>
  • Date: Sat, 9 Jun 2007 05:29:15 -0400 (EDT)
  • References: <>

At 04:31 AM 6/8/2007, Steve Luttrell wrote:
>I have bought myself a Logitech Dual Action gamepad as recommended in
>tutorial/IntroductionToManipulate, and I am very pleased with how flexibly
>it allows me to control Manipulate. This will make manipulation much easier.
>Out of curiosity I tried using the gamepad to manipulate a plain 3D graphic,
>where normally you would use the l.h. mouse button (optionally with Ctrl or
>Shift) to rotate/zoom/translate the graphic. I found that I could rotate the
>graphic by using the l.h. gamepad joystick, but I couldn't find any way to
>zoom or translate the graphic using the gamepad. Does anybody know how to do
>this, or it is not implemented?

Currently the built-in support for using the gamepad with 3D graphics 
allows for rotation, but not zooming or translation.

Binding Graphics3D options to the gamepad with other mechanisms 
like  Manipulate or ControllerState is an alternative.  Though it's 
slightly less convenient since it requires writing code to specify 
the relationship between the gamepad and the view options, it's very flexible.

Here's an example of a simple zoom feature that is tied directly to 
the vertical position of the right stick on your Logitech 
gamepad.  It changes the ViewAngle option dynamically.  The built-in 
support for rotation continues to work well because the built-in 
support doesn't modify the ViewAngle option.

Plot3D[Sin[x y], {x, 0, 3}, {y, 0, 3}, Axes -> False,
  ViewAngle ->
   Dynamic[Rescale[ControllerState["Y2"], {-1, 1}, {1 Degree, 179 Degree}]]]

Here's a version that isn't tied directly to the position of the 
stick, but increases or decreases the zoom based on the deflection of 
the stick from center.

DynamicModule[{va = 90 Degree},
  Plot3D[Sin[x y], {x, 0, 3}, {y, 0, 3}, Axes -> False,
   ViewAngle ->
    Dynamic[Module[{y = ControllerState["Y2"]},
      If[Abs[y] > 0.2, va += y*0.05; va = Clip[va, {1 Degree, 179 Degree}]];

Chris Hill
Wolfram Research 

  • Prev by Date: Re: Re: Re: v6: still no multiple undo?
  • Next by Date: Re: v6: still no multiple undo?
  • Previous by thread: 3D manipulation with gamepad in V6
  • Next by thread: Graphics Cell to another notebook