I want to put a scene in Unity into virtual reality using Google Cardboard.
I used to be able to just drag a CardboardMain prefab into the scene, delete the main camera, use CardboardMain as the camera position, and CardboardHead to track where the user was looking.
After reading the release notes for the new updates, I thought I could drag a GVREditorEmulator and GVRControllerMain into the scene, and keep the normal camera.
Unfortunately, I can't figure out how to get the camera to follow my character with this new setup. (In this case, a rolling ball.)
If I change the position of the normal camera, it looks like it works fine in Unity, but as soon as I upload it to my phone, the user stays in the same place, while the ball rolls away. (The user can still control the ball's movements, but the camera/user doesn't follow the ball at all.)
I had thought that the chase cam demo would be useful, but that's only for Daydream, and I'm using Cardboard.
This trick seemed to work for some people. I tried in on a previous version of Unity and a previous version of the SDK and it did not seem to work. I may just need to try it on this new version, but I'm worried about going into the released code and editing it, so I'd prefer answers that don't require this.
Is there any way I can get the user to move in a Google Cardboard scene in Unity when I upload it to my iPhone?
UPDATE:
It looks as though my main camera object is not moving, making me think that something is resetting it back to the center every time, lending some more credence to the "trick" earlier. I will now try "the trick" to see if it works.
UPDATE: It doesn't look like the lines listed in the "trick" are there anymore, and the ones that are similar in the new program don't even seem to be running. Still trying to figure out what continues to reset the main camera's position.
UPDATE: Just got a response back from Google on GitHub (or at least someone working on the SDK) that says "You just need to make the node that follows the player a parent of the camera, not the same game object as the camera." I'm not exactly sure what that means, so if someone could explain that, that would most likely solve my problem. If I figure it out on my own I'll post back here.
UPDATE: Zarko Ristic posted an answer that explained what this was, but unfortunately the tracking is still off. I found out how to get Google Cardboard to work with the old SDK and posted an answer on that. Still looking for ways to get the new SDK to follow a character properly.
You can't change positioin of camera in cardboard application, position of MainCamera it always must be 0,0,0. But you can just simply made empty GameObject and make it parent of MainCamera. In Cardboard games actualy you can move parent of camera instead MainCamera directly.
Add script for tracking ball to MainCamera parent (GameObject).
This does not answer my question, but is a solution to the problem.
Do not use the newest version of the SDK. Use version 0.6
When building the app in Unity, do not select to have VR enabled under the build settings. (VR will still be enabled in the app.) (Credit: Zarko Ristic)
When putting the app onto your phone, if XCode prompts you to change any settings, you can ignore it.
In addition, disable bitcode under "Build Settings -> Enable Bitcode -> No" (Currently, this will not allow you to put your app onto the app store. I would greatly appreciate it if anyone has information on how to get it to run without doing this.)
Now your app should run on your phone correctly.
Related
This is my first time to make a Unity project. Everything works well on the Game view in Unity Editor. However, after I built the project and played it on Google Chrome, I found that the position of some gameobjects had been changed.
Here is a more detailed explanation. The left is what I saw on the game view, which was perfect. The right side is what I saw after built the project. The position of the grey picture had been changed.
Does anyone know how to fix this?
ps.I am using Unity 2020.3.18 with WebGL platform
Try exporting again but with the same resolution as the game view. In this case you would want to export in a 400x600 resolution (You can also edit the "index.html" file to change and experiment with the resolution). The problem has to do with the fact that changing the resolution of the game can affect where certain objects are and how much you can see.
I have implemented basic player interactions, look, move, grab and move items and it all works fine.
The OVRGrabbable script (part of OVR plugin) makes the grabbed object`s rigidbody kinematic.
As a result, the object in hand is passing through other colliders. When the item is released everything works great but while in hand it passes through all colliders. It does not stop when it hits other colliders resulting passing with the object through a wall and etc.
I know that the OVRGrabbable script makes the object kinematic and that is why this happens. Can I do something to change this default behavior ? I need the object to stop when it hits the table, wall, not to pass through it.
Did anyone tried to solve this? Any advice ?
Thank you.
I have abandoned using the official Oculus SDK. Instead I have implemented VRTK SDK which is working great, and it supports a wider range of VR devices.
If anybody has a similar problem, VRTK solves this problem with colliders and other minor fixes.
https://github.com/thestonefox/VRTK
Good day everyone. I have a problem with my game since I'm using the openvr when building my game. The problem is whenever I build my game as a .exe, the position of my camera from my start menu is a little bit off, what I mean is that it is not placed like in the unity editor. And the second one is that even if i disable my track rotation under my head gameobject it still detects the trackrotation (When built).
So far what i had tried are:
1.) setting the trackrotation in the script into trackrotation = false; (still didn't work)
2.) Removing the GvrHead Script from the head(Still effin rotates).
Why is that it still rotate even if I already remove the script from the head and set the trackrotation = false in the script.
or should i disable the gyroscope from my project?
I need to disable it because of the animation I have on my game. It needs to disable the trackrotation.
Someone help.
I'm using my 3rd party software so i did go to vridge app on my phone and disable the tracking rotation of the 3rd party software . So that solves my problem .
Everyone.
Vuforia Camera does not work, but only black screen on Android 6.0+ versions.
Vuforia Version is 6.2.2 and Unity version is 5.4.4
But vuforia camera works on less than android 5.0
How can I fix this issues?
I hope you to teach me about this.
This is an interesting problem I have and there is an unacceptable temporary fix I am using while testing this system out. For the iPhone 7, to get past this suspend the app and then return to it. After about 2 seconds the camera will work. I am guessing it will work similar for android. I will update with a better fix if I come by a real fix after my testing if I decide to use this system.
Edit:
Short answer:
Delete the meta data for any pre-existing custom camera controller script. If you are using your own camera controller you need to disable the vuforia one and delete the meta for that. You are basically hijacking the camera feed after it starts.
long: I began this application by building out my own system and to test vuforia I disabled these items (like the camera feed). I went through the logs and saw that even with these items disabled the camera feed was still running and this feed started AFTER the vuforia camera so basically my own start() methods (even though they were disabled) were hijacking the camera from vuforia. It turns out that my meta data for my camera controller script was still poised to run the script even though everything was disabled. After deleting my camera controller script meta data it worked fine. You can also just delete the camera controller and it will delete the meta. By camera controller I mean my custom written camera controller that was built before I added in vuforia. This is a hard to find fix because it works fine in unity, but not when you build out to a device. The meta doesn't seem to update for the device, just the unity engine.
If you are using the vuforia camera make sure you either use the vuforia plane that comes as a child of the camera or delete the meta data to whatever camera script you wrote. You should get camera feed in a new empty project just by dropping in the vuforia camera, there is no need to build your own script and if you do, make sure one isn't overriding the other like mine was.
If you want to simply test to make sure it isn't your device or code create a NEW empty unity project, import vuforia (no need to import the database, just the sdk) and then drop the vuforia camera into the project and test it. Don't add anything extra or do any image recognition. If this works, it's your code somewhere.
I am using Vuforia 6.2.10, Unity 5.4.4.f(64 bit) and a Nexus 7 Android 6. I had the same issue where the camera was black. I started over, adding one component at a time. The AR Camera alone worked fine. Adding a Target Image also worked. I added a plane and image to the TI and the camera failed to work. Setting the image texture type to Sprite 2d and ui seemed to help.
I discovered that by deleting the app from the device and creating a apk file each time it worked.
I am not sure I'd count on Vuforia in the near term.
I try to run the samples/CardboardDesignLab/ustwo-cardboard-unity demo.
I just checked distortionCorrection-unity
Put it into the apkļ¼it is running normally in android devices.
but ,the same code, build and run in iphone is upside down,I only changed the distortionCorrection.
Please Help me,thanks very much.
First of all, that plugin is absolute. You should now be using Google VR SDK instead of google-cardboard.
If you are still reluctant to use the Google VR SDK, then find BaseCardboardDevice.cs script in the plugin, then find a function inside it called UpdateState().
Add headPose.Set(headPose.Position, headPose.Orientation * Quaternion.Euler(0,0,180)); to the end of that function. That's it. It will rotate the Camera back to 180 which make it look normal again.