VR with Oculus Quest 2

VR with Oculus Quest 2

Clara1
Not applicable
23 Views
4 Replies
Message 1 of 5

VR with Oculus Quest 2

Clara1
Not applicable

[ FlexSim 24.0.2 ]

Hello,

I have a model of a manufacturing line in which I want to implement the use of VR with Oculus Quest.

I want to do something simple like put a joystick that, when moved, varies "run speed" in the model. I don't know how to do it, I'm using the example of the model with VR but even so, I still don't know.


I hope you can help me

oculustouchdemo-6.fsm

0 Likes
Accepted solutions (1)
24 Views
4 Replies
Replies (4)
Message 2 of 5

moehlmann_fe
Explorer
Explorer
Accepted solution

The interaction with the model is handled entirely in the "OnModelPreDraw" user command in the demo model (which calls some of the other user commands). It is run each time before a new frame is generated (through the custom "HandleDraw" object that was added to the tree).

1719217025843.png

I suggest you have a look at that code. There are some comments to show what each code section is roughly responsible for and the variable names are generally chosen so that the code should be understandable to anyone who has some coding experience.

Inputs from the controllers are read with the stick command, so having a look at its documentation might help to understand the code better.

Message 3 of 5

Clara1
Not applicable

Please could you help me a little more? I just want a joystick that varies the run speed, but I don't understand anything about the example model

It's very important and urgent for me

0 Likes
Message 4 of 5

moehlmann_fe
Explorer
Explorer

I can try, but this is an advanced topic. I don't have a VR setup currently up and running, so I can't test this. It should work, but no promises.

Lines 275-346 handle gripping and moving the handle bar and its impact on the crane z-movement (since run speed is a 1-dimensional value it makes sense to use this object to control it, at least in my mind).

1719221718875.png

Of those lines, only 339-345 deal with the actual crane movement. If you replace them with something like this

double exponent = -handle.rotation.x / 16;
runspeed(Math.pow(2, exponent));

the handle bar should then control the speed (between 1/32 to 32).

Removing all the other control code for the other interactive objects will leave you with the user command code as in the attached model.

You'd need to copy all user commands, the "Handle" object (the thing you will grip in VR) and the "HandleDraw" object (the custom object I highlighted in the answer, copy the treenode from the tree, add a new treenode to the tree of the other model and paste this in there) to the other model. Add the "Handle" global variable and make it be a tree node variable that points to the "Handle" object.

runspeed-control.fsm

Message 5 of 5

Clara1
Not applicable

it works perfectly. Thank you very much, you have helped me a lot

0 Likes