Move Camera Using Xbox Controller

Move Camera Using Xbox Controller

Anonymous
Not applicable
1,046 Views
2 Replies
Message 1 of 3

Move Camera Using Xbox Controller

Anonymous
Not applicable

Hello all. I am trying to move the camera through a model using my own control system. So far I have the code to make a plugin and currently, when you click on the plugin, the document name will get printed out, and when you have selected items, it will move the camera to view each selected item one by one.

 

My question is, how can I move the camera by a certain step repeatedly? My current attempt is to create a new thread that runs all this code, but when I try to update the document viewpoint, the application crashes. Have there been similar projects like this? Is there something I am missing?

 

Thank you for the help!

0 Likes
1,047 Views
2 Replies
Replies (2)
Message 2 of 3

ulski1
Collaborator
Collaborator
Yes several have attempted this including our company. We concluded that if users are to use xbox or playstation controllers as a input device for Navisworks, then Autodesk have to provide the support built-in - it is too cumbersome to fiddle with ourselfs. We did get it to a point where we could navigate with a controller, but it did not feel 100% like a native part of the application.
The reason you see a crash is because you are not allowed to change current(active) view directly - you always have to use the "copyto" method
Like so:
// update current viewpoint
oDoc.CurrentViewpoint.CopyFrom(oCurrVCopy);

br
Ulrik
0 Likes
Message 3 of 3

Anonymous
Not applicable

I am using the CopyFrom method now, the trouble is that method won't work on a separate thread. My goal is when an user clicks on the plugin, the Execute method will start a new thread and exit. The new thread will run in an infinite loop getting controller input, and moving the camera. The CopyFrom method does not seem to work on a separate thread and I was wondering if there was a way around that. 

0 Likes