how to make 3d mouse control an object in my own program?

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

Moderator: Moderators

Post Reply
Perhads
Posts: 3
Joined: Tue Jun 15, 2021 1:42 am

how to make 3d mouse control an object in my own program?

Post by Perhads » Tue Jun 15, 2021 1:59 am

I use C++ to code my program,and i download sdk for windows.
but i dont understand the samples.
how should i do if i want to use 3dmouse to control an object to move and rotate.
Is there some simple examples?

thx :D :D :D :D

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

Re: how to make 3d mouse control an object in my own program?

Post by jwick » Tue Jun 15, 2021 10:58 pm

That's a pretty open-ended question.
You need to start by asking how to move 3D objects in the 3D API you are using.
Then you need to hook up the 3D mouse to that mechanism.

Perhads
Posts: 3
Joined: Tue Jun 15, 2021 1:42 am

Re: how to make 3d mouse control an object in my own program?

Post by Perhads » Tue Jun 15, 2021 11:59 pm

jwick wrote:
Tue Jun 15, 2021 10:58 pm
That's a pretty open-ended question.
You need to start by asking how to move 3D objects in the 3D API you are using.
Then you need to hook up the 3D mouse to that mechanism.
sorry my english is sososososo bad,hope i could express what i wanna say.
actually i have an opengl program,generally I use function glfwGetKey() to get the keyboard event.
Becauese i usually get keyboard event,and i can change the matrix then it will effect the render loop. I just use this method to move object or my camera.
But when i use 3dmouse and read the sample named navlib_viewer, i was confused.
I read the code and make some breakpoints, I just found that the program just get a struct named "value", it will change when 3dmouse input, and use this value do something.
i read the document but it's not very detailed.
this is the struct code

Code: Select all

  union {
    void *p;
    bool_t b;
    long l;
    float f;
    double d;
    point_t point;
    vector_t vector;
    plane_t plane;
    box_t box;
    frustum_t frustum;
    matrix_t matrix;
    const SiActionNodeEx_t *pnode;
    string_t string;
    cstr_t cstr_;
    imagearray_t imagearray;
  };

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

Re: how to make 3d mouse control an object in my own program?

Post by jwick » Wed Jun 16, 2021 12:32 am

The general idea with the latest SDK is that you don't get raw events from the device.

When something happens on the device, the SDK asks for your view matrix, it changes it to reflect whatever happened on the 3D mouse and it returns a new view matrix to your application. This completely isolates your code from any future changes in the input device and between different 3D mouse models.

This might help to understand the SDK sample. As you are doing (and I often do myself), walking through the sample in the debugger is very informative.

Post Reply