Forum rules - please read before posting.

Unity and Google VR Problem

Hello,

I’m having some difficulties with Unity and Google VR. When I run the game in the editor everything is fine but when I test it on an Android device, I’m experiencing the following issues:

1. The GetActiveHotspot method returns null when the reticle is over any hotspot. It returns a perfectly legal Hotspot object when running in the editor.
2. The player’s initial position isn’t where the PlayerStart marker is. Instead, the player appears at the main camera position. Again, works fine in the editor.

I’m using Unity 5.6 (with “Virtual Reality Supported” in Player Settings turned on and “Cardboard” as the Virtual Reality SDK), Google VR 1.3 and AC 1.56g.

If necessary, I’ve made a small project showing the above issues.

Thanks,
Daniel.

Comments

  • edited April 2017
    Unfortunately, I've never developed for Google VR, so I'm not sure how the Player is setup for that platform, but I do have experience working with Vive and Occulus (we have a project, which we still have in alpha state). 

    Anyway, you'll encounter a few issues working with VR since AC doesn't officially support it yet (and neither do most other assets in the store yet...). One of the biggest issues with a VR Player is that, depending on your Rig setup, the player will tend to move in local space. If the camera is parented to another object (and the camera always IS the player in VR), then you know it's moving in local space, not worldspace. If you watch the game view and scene view sideby side you'll most likely see the parent object's center left behind as the camera advances in the level, all by itself. This movement in local space will sometimes cause issues with teleporting, cause most teleport scripts usually move an object in worldspace, not local space. It will also be liable to get in the way of triggers (you'll need to make sure your camera's collider, or whatever your rig is using for collisions has the Player tag too, in some cases you may need to setup your triggers to check for the Player Tag, instead of the regular Player options, I'm not entire sure how AC determines who the player is, but it sometimes won't work in VR).

    That said it'll be hard to say, unless I see a picture of your player object hierarchy and get some more information. 

    I've personally had to use an entirely custom object hierarchy for my Players (to ensure they works properly with VRTK, which I've integrated into the project). 

    Also, another possible cause for your issue... in VR you better forget about GameCameras. You don't want to have anything other than the MainCamera in your scenes, else you may be seeing the world through the wrong camera, giving you the feeling that the player is in the wrong place, when it's the camera that's in the wrong place. I've found it works better to just drop the MainCamera script, and tag, in the "Eye" camera of my Vive and Occulus players. 
  • 1. What is your Hotspot detection method set to in the Settings Manager?  That affects how the active Hotspot is determined (actually, probably best to post all such settings).

    2. When you say "player", are you referring to the player prefab or the actual person playing?
  • Thanks Alverik and Chris,

    Alverik, thank you very much for your insights. I will definitely go over them more thoroughly in the near future and see if they apply to Google VR as well.

    Chris, my Hotspot detection method is set to Mouse Over. As for other settings, I'm not sure what you would like to see but I have created a small test project to to demonstrate these specific issues so I can PM it to you if you think it will help. As for "player", I meant the in-game player prefab, not the person playing.

    Thanks.

  • As my own experience with GoogleVR is minimal, I can't promise anything - but send it over and I'll see what I can glean from it.
  • Sent the project.

    I’m not really looking for promises but I believe you’ll be able to find out why the Active Hotspot is null on an Android device.

    Thank you very much!

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.