question

Hao Zhou avatar image
0 Likes"
Hao Zhou asked Hao Zhou commented

View moving in VR environment

I would like to use Oculus touch to control view angle around a machine. Is there a way of moving view in the VR environment by Oculus touch? I actually spent some time to investigate the warehouse model to learn some model interaction controls. Is there another example model of showing view moving by Oculus touch.

Thanks for the help!

FlexSim 19.0.2
vr display
5 |100000

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

1 Answer

·
Phil BoBo avatar image
0 Likes"
Phil BoBo answered Hao Zhou commented

You can adjust the view by changing its attributes, such as viewpointx, viewpointy, viewpointz, viewpointrx, viewpointry, and viewpointrz.

For example, in the Oculus Touch demo, the ModelOnPreDraw code calls this:

if (getvarnum(view, "vrmode")) {
	set(viewpointrx(view), 0); // remove rotation looking up/down
	set(viewpointry(view), 0); // remove head tilt
	set(viewpointradius(view), 1.74); // suggested eye level height in meters
}

That explicitly sets the viewpointrx and ry to 0 to prevent rotating the view up/down or head tilt.

You can set viewpointradius to adjust the height of the camera. viewpointx and viewpointy are the location of the camera. viewpointrz controls the camera's rotation (turning your head). viewpointrx is related to looking up and down. viewpointry is related to tilting to the side.

Those attributes are the base position of the camera's space. Any physical movements of the headset are applied after those attributes.

You can use the stick() command to get the state of the Oculus touch controllers.

The Oculus touch demo model has examples of using the stick() command to get the status of the controllers as hands touching physical objects in space. If you want to use them as controllers, such as moving via tilting the thumbstick, you may want to look at the Xbox Input code for an example of moving the view via thumbstick: VIEW:/standardviews/documentwindows/Perspective>eventfunctions/XboxInput

The code for the default teleporting mechanism of the Touch controllers is in VIEW:/standardviews/documentwindows/Perspective>eventfunctions/OnDraw and VIEW:/standardviews/documentwindows/Perspective>eventfunctions/TouchInput.

You may be interested in that code as well for examples of changing the view via input from the touch controllers.

· 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.

Hao Zhou avatar image Hao Zhou commented ·

Thanks for the information Phil. I really appreciate it.

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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