# \[SOLVED\] Virtual Reality Centring an Image

**URL:** https://discourse.processing.org/t/solved-virtual-reality-centring-an-image/4239
**Category:** Processing for Android
**Created:** [October 8, 2018, 7:33am UTC](https://discourse.processing.org/t/solved-virtual-reality-centring-an-image/4239 "2018-10-08T07:33:15Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![RockyHawk](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/rockyhawk/32/14384_2.png) [@RockyHawk](https://discourse.processing.org/u/RockyHawk)
#### Post date: [October 8, 2018, 7:33am UTC](https://discourse.processing.org/t/solved-virtual-reality-centring-an-image/4239/1 "2018-10-08T07:33:15Z")

</div>

So I have a basic processing VR script for the daydream headset, I have it below.

```auto
import processing.vr.*;
PImage title;
void setup() {
  fullScreen(STEREO);
  title = loadImage("title.png");
  title.resize(width/2,height/2);
}

void draw() {
  background(0);
  translate(width/2, height/2);
  image(title,0,0);
}

```

The image always shows up really far down and I’m not sure what to do to get it to the center. Does anyone know how to get an image to the center?

---

<div class="post-metadata">

### Author: ![RockyHawk](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/rockyhawk/32/14384_2.png) [@RockyHawk](https://discourse.processing.org/u/RockyHawk)
#### Post date: [October 8, 2018, 8:03am UTC](https://discourse.processing.org/t/solved-virtual-reality-centring-an-image/4239/2 "2018-10-08T08:03:16Z")

</div>

UPDATE: Fixed it. If anyone has a similar problem do the following:

```auto
import processing.vr.*;
PImage title;
void setup() {
  fullScreen(STEREO);
  title = loadImage("title.png");
  title.resize(width/2,height/2);
}

void draw() {
  background(0);
  imageMode(CENTER);
  translate(width/2, height/2);
  image(title,0,0);
}

```

---

<div class="post-metadata">

### Author: ![jb4x](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jb4x/32/789_2.png) [@jb4x](https://discourse.processing.org/u/jb4x)
#### Post date: [October 8, 2018, 8:33am UTC](https://discourse.processing.org/t/solved-virtual-reality-centring-an-image/4239/3 "2018-10-08T08:33:05Z")

</div>

Thanks for sharing your solution 👍

---

<div class="post-metadata">

### Author: ![wasdswag](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/wasdswag/32/5716_2.png) [@wasdswag](https://discourse.processing.org/u/wasdswag)
#### Post date: [July 2, 2019, 5:40pm UTC](https://discourse.processing.org/t/solved-virtual-reality-centring-an-image/4239/4 "2019-07-02T17:40:39Z")

</div>

Thanks for sharing!  
btw, in addition to this, does anyone know how to ignore the tilt of the phone on application launch when you deal with images?  
I mean, if I place an image in my vr-app, it aligns and displays correctly only if I keep my phone right in front of eyes (landscape orientation and 90 degrees) before it starts. Otherwise, it can moves left/right/up/down depend on the tilt angle of the device which was on the launch time, (when you see “place your phone into your cardboard” splash screen)
