question

Raashid Mohammed avatar image
0 Likes"
Raashid Mohammed asked Phil BoBo commented

Use Xbox controller to move the gameview operator

Hi

Model in the link below. It converts the operator into game mode where operator can move using keyboard up,down,left and right button

see link for more info

https://answers.flexsim.com/questions/30134/is-there-a-way-to-create-a-game-in-flexsim.html

Is there a way I can move the operator using Xbox controller in VR mode. both first and third person view

Thanks

Raashid

Choose One
vrxbox
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Phil BoBo avatar image
6 Likes"
Phil BoBo answered Phil BoBo commented

Attached is an updated version of the model from the original question, modified to use the Xbox Input code from the default Perspective View in the custom 3D Game View.

That game model was purposefully built with a minimal amount of extra stuff in it so that it is easier to understand. Adding Xbox Inputs adds more complexity to the code, as described below:

The things added to this version to make the xbox input work:

  1. OnPreOpen was added to the view that calls stick(num, 20) to determine what xbox controllers are connected to the computer.
  2. Variables were added to the Perspective view to store what xbox controllers are connected and their last update time.
  3. A function called XboxInput was added with custom code to read the xbox inputs and use them to move the operator and viewpoint.
  4. OnPreDraw was updated to call the XboxInput function.
  5. The code to load/unload an item was moved to its own function so that the xbox A button and the spacebar handler can both call the function.

To handle Xbox input, I copied and modified stuff from the existing Perspective view code that is in the tree at VIEW:/standardviews/documentwindows/Perspective>eventfunctions/XboxInput

If you don't understand how referencing in the tree works, then this type of development may be more advanced than you can do by yourself right now. You may want to contact FlexSim for additional training or consulting work.


· 4
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Ralf Gruber avatar image
0 Likes"
Ralf Gruber answered Raashid Mohammed edited

Raashid,

have you seen this:

https://answers.flexsim.com/questions/30260/how-i-can-use-and-configure-the-xbox-controller-in.html

This describes where the logic can be found to manipulate control through Xbox controller.

· 1
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.