# Get orientation in VR mode?

**URL:** <https://discourse.processing.org/t/get-orientation-in-vr-mode/3260>\
**Category:** Processing for Android\
**Created:** [September 4, 2018, 7:59pm UTC](https://discourse.processing.org/t/get-orientation-in-vr-mode/3260 "2018-09-04T19:59:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jetjaguar](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jetjaguar/32/1370_2.png) [@jetjaguar](https://discourse.processing.org/u/jetjaguar)\
**Post date:** [September 4, 2018, 7:59pm UTC](https://discourse.processing.org/t/get-orientation-in-vr-mode/3260/1 "2018-09-04T19:59:37Z")

</div>

Hey everybody!

I’d like to get whatever my orientation is while in VR mode. I don’t mean just landscape or portrait but the exact azimuth, e.g. -PI to PI.

I know how to get my orientation via the compass example, but the sensors are allready being called upon in VR mode, so I don’t think I should call upon them again. I’ve been combing through the library files without luck.

I’ve written code that allows the user to walk through a VR environment, but I need the current orientation so that, for example, the UP key always moves the user forward.

Anybody know? Thanks in advance!

---

<div class="post-metadata">

**Author:** ![jetjaguar](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jetjaguar/32/1370_2.png) [@jetjaguar](https://discourse.processing.org/u/jetjaguar)\
**Post date:** [September 5, 2018, 9:00pm UTC](https://discourse.processing.org/t/get-orientation-in-vr-mode/3260/2 "2018-09-05T21:00:54Z")

</div>

Think I got it.

```auto
import processing.vr.*;

PMatrix3D eyeMat = new PMatrix3D();

void setup() {
  fullScreen(STEREO);
}

void draw() {

  getEyeMatrix(eyeMat);
  println(eyeMat.m00);
  
} 

```

---

<div class="post-metadata">

**Author:** ![kfrajer](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kfrajer/32/196_2.png) [@kfrajer](https://discourse.processing.org/u/kfrajer)\
**Post date:** [September 5, 2018, 10:47pm UTC](https://discourse.processing.org/t/get-orientation-in-vr-mode/3260/3 "2018-09-05T22:47:54Z")

</div>

Maybe these next posts are relevant:

> [Matrix Transformation Question - Processing 2.x and 3.x Forum](https://forum.processing.org/two/discussion/13723/matrix-transformation-question)

> [Matrix: after translate/rotate in P3D: can we save the Matrix other than with pushMatrix()? - Processing 2.x and 3.x Forum](https://forum.processing.org/two/discussion/23780/matrix-after-translate-rotate-in-p3d-can-we-save-the-matrix-other-than-with-pushmatrix)

Kf
