How to detect zoom direction

Post questions, comments and feedback to our 3Dconnexion Windows Development Team.

Moderator: Moderators

Post Reply
andyc
Posts: 8
Joined: Mon Mar 19, 2007 9:08 am

How to detect zoom direction

Post by andyc »

How do I detect which Zoom direction is selected in the user control panel (Device configuration).

I need to know because some users set their zoom direction to up/down and this breaks/switches rotation (try the cityfly demo)
jwick
Moderator
Moderator
Posts: 3331
Joined: Wed Dec 20, 2006 2:25 pm
Location: USA
Contact:

Post by jwick »

Hi andyc,

When you change Zoom Direction in the control panel, it rotates the entire coordinate system of the device accordingly. It aligns the device as if your Windows desktop really is a flat "desktop" you are looking down upon. The Spin and Roll axes also rotate by 90 degrees just like the zoom and pan up/down directions.

We just call it 'zoom direction' because that is the most obvious characteristic that people will recognize, and that is the fundamental axis they are trying to change. Consistency dictates that the entire coordinate system rotate.

Jim
3Dx Software Development
andyc
Posts: 8
Joined: Mon Mar 19, 2007 9:08 am

Post by andyc »

Yes I understand this - but how do I detect this has changed?

The cityfly demo doesn't detect it - you can no longer rotate.

I am programming for flying.

Andy
jwick
Moderator
Moderator
Posts: 3331
Joined: Wed Dec 20, 2006 2:25 pm
Location: USA
Contact:

Post by jwick »

Hi Andy,

Changing the orientation doesn't change the number of axes sent. It just rearranges them. In cityfly's case, the spin is now on the roll axis (think barrel roll).

I suggest you let the users do whatever crazy thing they want to the axes.

You can use the Sync API to receive notification that they have changed something. You can even change it back. But that would be evil.

You can change the configuration for your app to make changes to the zoom direction basically a no-op. See viewtopic.php?p=832#832 for instructions on how to change the HRZ and VRT axis maps. If you make them both the same, the operation will be a nop. This is also somewhat evil (more of a mini-evil). It requires that you distribute a config file and make sure your users use it (that can not be guaranteed).

I suggest you remain at the mercy of your users. Changing the orientation is a positive act. They know they did it.

Jim
3Dx Software Development
andyc
Posts: 8
Joined: Mon Mar 19, 2007 9:08 am

Post by andyc »

Umm - I don't like that. I want people to be abe to fly the with the same controls, whatever they have set up for the zoom directrion.

Is this the same info that's given by SiSyncGetOrientation?

SPWint32 axes[6];
SiSyncGetOrientation( devHdl, axes );

for (int n=0; n < 6; n++)
printf("axis %d %x\n", n, axes[n]);

This doesn't get any useful info - is there a silly programming error here?
jwick
Moderator
Moderator
Posts: 3331
Joined: Wed Dec 20, 2006 2:25 pm
Location: USA
Contact:

Post by jwick »

Hi Andy,

You may want to take a look at how we did the GoogleEarth configs. The user can change the altitude direction, but the spin stays on the same axis.

To use the SiSyncGetOrientation call, you need to enable syncing in the configuration file of your app. This is described in the SDK doc. You need to define APP_CONTROLS_BUTTONS = TRUE in the conifg. You also have to have had to call SiGetEvent at least once after your config is loaded.

The best way to use the sync mechanism is lookup what they've done, then wait for SI_SYNC events that indicate that they have changed something.

Jim
3Dx Software Development
andyc
Posts: 8
Joined: Mon Mar 19, 2007 9:08 am

Post by andyc »

Thanks for your help Jim,

Is there any way to do the equiv. of APP_CONTROLS_BUTTONS = TRUE without a config file? Our software is Tcl/Tk and it doesn't use Windows config files.

If I can just read the axis setup, that will be all I need.

Thanks,

Andy
jwick
Moderator
Moderator
Posts: 3331
Joined: Wed Dec 20, 2006 2:25 pm
Location: USA
Contact:

Post by jwick »

Nope. The only way to start the syncing process is to have a config file that says it is allowed.

All applications use 3DxWare config files in the driver. If nothing else one is selected for you by default. You can specify which config file is used by either creating one and supplying it by default, or modifying the registry to tell the driver which config file to use for your executable.

You have other options: you can use DirectInput or HID calls directly. This takes the driver out of the loop. Anything they do in the driver will be ignored. You give up being able to display anything on the SpacePilot LCD.

Jim
3Dx Software Development
andyc
Posts: 8
Joined: Mon Mar 19, 2007 9:08 am

Post by andyc »

Thanks Jim,

Andy
Post Reply