Wrecked Games

Please login or register.

Login with username, password and session length
Advanced search  

News:

We're just that awesome.

Author Topic: Support request for 3D navigation devices, examples: http://www.3dconnexion.com/  (Read 5486 times)

reptor

  • Newbie
  • *
  • Karma: +0/-0
  • Posts: 6
    • View Profile

Hello,

it would be great if OIS supported 3D navigation devices like the ones from http://www.3dconnexion.com/

Such a device is very, very, very good for controlling a 3D view. Although such devices are most often used in professional applications like in 3D-modelling applications, I see that those devices could be used succesfully in games too. So the applications are many for such devices.

If you try to shoot this idea down by saying "it's not that good a device to control a 3D view!" then I tell you, "then you never tried it, now go and try it and get used to it, then come back and say did it help you to reduce pain in your wrists (yes it does that very well), did it help you work faster (yes it does that too)?"

To my knowledge there has been some work in/around the Blender project ( http://www.blender.org/ ) to get those devices working in Blender. As far as I know, currently there are no official support by the Blender project for those devices but some people have done some work to achieve it. I recall they made/are planning to make some kind of universal driver which can support those devices, and it would not require drivers from 3dconnexion, which, as I understood, could not be mixed with GPL'd code such as Blender (but some people already claimed they had a way to circumvent this license problem! in some Blender patch page there is talk about this). I'm telling this about the Blender project in the case you get interested about implementing the support for those devices, and would like to have some starting point.

Thanks in advance for having a look if this is possible!

 :)
« Last Edit: October 16, 2007, 11:42:53 AM by reptor »
Logged

OvermindDL1

  • Administrator
  • Veteran
  • *****
  • Karma: +0/-0
  • Posts: 288
    • View Profile
    • http://www.overminddl1.com/forum/

Shouldn't it already work fine if it uses any standard HID communication (such as the joystick HID from how it looks), unless the api was poorly made of course (probably to try to extort more money from people)?
Logged

reptor

  • Newbie
  • *
  • Karma: +0/-0
  • Posts: 6
    • View Profile

How is that going to work, when a basic analog joystick has only 2-degrees-of-freedom, and a 3D-navigation device has 6-degrees-of-freedom?

Basic analog joystick: forward-backward axis, left-right axis, that's only 2-degrees-of-freedom!

3D-navigation device: forward-backward axis, left-right axis, up-down axis, AND rotation around all of those 3 axis, that is 6-degrees-of-freedom!

To me it sounds very much like it's not going to work out-of-the-box.

By the way I today noticed this at the 3dconnexion website:

http://www.3dconnexion.com/news/press/080707_Blender.htm

Quote
3Dconnexion Announces Public Beta Release of Plug-Ins for Blender Support

I'll need to check exactly what kind of support they are giving. Maybe it could be adjusted to other projects too... I'll need to check what kind of plug-in it is and what of kind of license it has!

but I still ask the OIS developer(s) what is their opinion about this. This case isn't settled yet  :P
Logged

OvermindDL1

  • Administrator
  • Veteran
  • *****
  • Karma: +0/-0
  • Posts: 288
    • View Profile
    • http://www.overminddl1.com/forum/

Uh, you do know a normal joystick hid supports something like 12 degrees (or more? don't remember), right?  Most joysticks use four (ditto with most gamepads now), but there are things that use all.

So yes, it sounds like it should work quite well with the standard joystick HID.
Logged

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +0/-0
  • Posts: 2652
    • View Profile
    • http://www.wreckedgames.com

Support for this device (and all devices) is welcome, and can easily be added by providing the correct factory creator for such a device. And, I believe that this device could be represented as a joystick with multiple axis, or vector controls depending on what kind of values it provides. Anyway, I think there was a initial support patch for this device posted to the forum but lost :(
Logged

reptor

  • Newbie
  • *
  • Karma: +0/-0
  • Posts: 6
    • View Profile

Thanks for your replies.

There seems to be this

http://www.wreckedgames.com/forum/index.php?topic=871.0

thread about it. And it indeed seems that the link to a patch made by Absum doesn't work. That's bad.

I sent Absum a private message, asking to give us the patch again.

The patch should be stored into this website so that it isn't lost again.

Well I am sure it can be made again by someone, but if there is existing work we should use that as a starting point.
Logged

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +0/-0
  • Posts: 2652
    • View Profile
    • http://www.wreckedgames.com

Thanks for your replies.

There seems to be this

http://www.wreckedgames.com/forum/index.php?topic=871.0

thread about it. And it indeed seems that the link to a patch made by Absum doesn't work. That's bad.

I sent Absum a private message, asking to give us the patch again.

The patch should be stored into this website so that it isn't lost again.

Well I am sure it can be made again by someone, but if there is existing work we should use that as a starting point.

Ideally, all patches should be added to the sourceforge.net project page tracker system. As, sometimes things get forgotten about, and links all not always forever - though, I should have reacted to that patch quicker and added it the patch tracker.
Logged

Absum

  • Newbie
  • *
  • Karma: +0/-0
  • Posts: 13
    • View Profile

Thanks for your replies.

There seems to be this

http://www.wreckedgames.com/forum/index.php?topic=871.0

thread about it. And it indeed seems that the link to a patch made by Absum doesn't work. That's bad.

I sent Absum a private message, asking to give us the patch again.

The patch should be stored into this website so that it isn't lost again.

Well I am sure it can be made again by someone, but if there is existing work we should use that as a starting point.

Ideally, all patches should be added to the sourceforge.net project page tracker system. As, sometimes things get forgotten about, and links all not always forever - though, I should have reacted to that patch quicker and added it the patch tracker.

As said in my thread, the patch is up again and I would really like it if anyone took upon him/herself to clean it up and apply it to the current version since I don't work much in ogre now days.
Logged

reptor

  • Newbie
  • *
  • Karma: +0/-0
  • Posts: 6
    • View Profile

Thanks for the patch.

In the name of preserving information, I submitted the patch to the sourceforge wgois patch tracker at:

http://sourceforge.net/tracker/index.php?func=detail&aid=1821175&group_id=149835&atid=775955



Just for reference, other threads here at the Wrecked Games OIS forum relating to this subject:

6 DOF device [3Dconnexion space navigator as example]
http://www.wreckedgames.com/forum/index.php/topic,871.0.html

3DxWare support
http://www.wreckedgames.com/forum/index.php/topic,800.0.html
Logged

Moohasha

  • Newbie
  • *
  • Karma: +0/-0
  • Posts: 11
    • View Profile

I've added support for Space Navigator (and presumably other 3D input devices) on Windows machines as well.  I don't know how to do patches or anything on Subversion ( :-[ ) so I'll post the changes here.  All changes go in the Win32JoyStick.cpp file. 

I added the following #defines to the top to avoid using magic numbers:
Code: [Select]
/** Added to support SpaceNavigator **/
#define XAXIS   0
#define YAXIS   1
#define ZAXIS   2
#define XROT    3
#define YROT    4
#define ZROT    5

Then down in the body of Win32JoyStick::capture() I added the following cases to the switch statement:
Code: [Select]
            case DIJOFS_X:
                axisMoved[XAXIS] = true;
                mState.mAxes[XAXIS].abs = diBuff[i].dwData;
                break;
            case DIJOFS_Y:
                axisMoved[YAXIS] = true;
                mState.mAxes[YAXIS].abs = diBuff[i].dwData;
                break;
            case DIJOFS_Z:
                axisMoved[ZAXIS] = true;
                mState.mAxes[ZAXIS].abs = diBuff[i].dwData;
                break;
            case DIJOFS_RX:
                axisMoved[XROT] = true;
                mState.mAxes[XROT].abs = diBuff[i].dwData;
                break;
            case DIJOFS_RY:
                axisMoved[YROT] = true;
                mState.mAxes[YROT].abs = diBuff[i].dwData;
                break;
            case DIJOFS_RZ:
                axisMoved[ZROT] = true;
                mState.mAxes[ZROT].abs = diBuff[i].dwData;
                break;

These look for movement and rotation on the X-, Y-, and Z-axis and updates the values for each axis in the JoyStickState.  These events are different from the ones that are treated as axis events for normal joysticks.  I've tested this in an Ogre application and it works fine.  Enjoy.  :)
Logged

Moohasha

  • Newbie
  • *
  • Karma: +0/-0
  • Posts: 11
    • View Profile

Ok, this is random.  This code has been working fine for weeks, and now all of the sudden something is wrong.  I'm using this in Ogre to control the camera, and now when I'm not touching the SpaceNavigator, it drifts off to the left.  I've confirmed this in two seperate Ogre applications using the SpaceNavigator.  It doesn't do this in the demos that come with the device, so I don't think it's a hardware issue.  I haven't touched the OIS code since I made the above update. 
I output the absolute values of the JoyStick device each frame, and some of the axes are deffinately changing.  It only does this when OIS has controll over the device though.  For example, if the coorperation level is set to exclusive and I alt-tab, it doesn't drift.  Does anyone know what might be wrong?
Logged

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +0/-0
  • Posts: 2652
    • View Profile
    • http://www.wreckedgames.com

Hmm, OIS does set a few device settings (like axis extents), I wonder if this the cause. Anyway, if the drift is minor, you should ignore it (some joy axes just drift and don't center).
Logged

Moohasha

  • Newbie
  • *
  • Karma: +0/-0
  • Posts: 11
    • View Profile

Hmm, OIS does set a few device settings (like axis extents), I wonder if this the cause. Anyway, if the drift is minor, you should ignore it (some joy axes just drift and don't center).
Sometimes it's minor, sometimes it's not, and sometimes it doesn't drift at all.  Unfortunately, I can't just ignore it because the thing is used to control the camera in a 3d user interface, so when it drifts it causes the camera to spin around.  And the user won't always be moving the camera around all the time, so you can't just compensate for it.
I wonder why this just started happening...
Logged