Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

3D manipulation with gamepad in V6

7 views
Skip to first unread message

Steve Luttrell

unread,
Jun 8, 2007, 5:35:01 AM6/8/07
to
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?

Steve Luttrell
West Malvern, UK

Chris Hill

unread,
Jun 9, 2007, 5:33:55 AM6/9/07
to

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}]];
va]]]]

Chris Hill
Wolfram Research


0 new messages