Unity Quest 2 can't grab objects with XR Grab Interactable - unity3d

I'm new to developing in Unity and VR, and I just managed to load a scene with my custom model into the Quest 2. Now I want to grab an object with the XR Grab Interactable, but when I try to grab the object nothing will just happen. I did not adjust any settings.
I'm also not sure if I connect with the headset the right way because of this. I made a VR project in Unity and connect to my laptop via AirLink. When I press play the scene loads into the headset, so I hope that is just right.

Related

Unity3D: How does Spectator View work through user side of Hololens?

I am having a hard time understanding the documentation. So I trying to spectate using a Hololens mounted on a camera. The user Hololens has an application. What do I need to do on the user side Hololens to enable Spectator View? Does it require MRTK? What components do I need to add to make on the Unity3D application (user side) to make it visible by the Spectator Hololens
What do I need to do on the user side Hololens to enable Spectator View? Does it require MRTK?
First, you need to go through the Getting Started to obtain and reference the MixedReality-SpectatorView codebase in your project.
Then, add the MixedReality.SpectatorView/SpectatorView/Prefabs/SpectatorView.prefab to the primary scene and choose a Spatial Alignment Strategy, following Basic Unity Setup for step-by-step tutorial.
For Video camera rig HoloLens, you need to calibrate and test your device according to this document: Spectator View Video Camera Setup.
After that, the PC listens to pose updates from video camera rig hololens and gets scene information from the user HoloLens, then composites this application content into the video camera stream.
Besides, MRTK as an SDK is intended to accelerate the development of MR projects and is not required to enable SpectatorView.

Oculus Headset detached while oculus attached with the pc

I am working on the Oculus project, The player character for my simulation in Unity. in which I have firstperson controller, I have created game object of player in which I put FPCamera as a child and character's body.
Issue: When I attach my oculus camera it detached from the body and with the Oculus headset movement, FPcamera act as a separate view from the body. the body does not rotate and remain static even though FPcamera is moving according to the headset. However it works fine if I disable oculus and move the character with the mouse, I can see my body and move left right everything with all animations.
I have the following link for the oculus controllers integrations in my project
https://assetstore.unity.com/packages/tools/integration/oculus-integration-82022 (Oculus integration)
here is a link which I have to achieve for my project, my FirstPerson should be like this in Oculus. you can see that the movement is with accuracy according to its headset movements
https://www.youtube.com/watch?v=7GpxsI-Tag
Note: I am using Unity 2017, there is no crash report in the project
First of all send the correct link for the video please.
When i create a new scene and I want to implementate the oculus player,cameras and hands I make this:
Find "OVRplayercontroller" prefab and drag to the scene
Find "CustomHandLeft" and "CustomHandRight" and drag to the scene
Go to the child object in OVRplayercontroller>OVRcameraRig>TrackingSpace
Then selec the 2 hands
And drag the TrackingSpace object to the "Parent transform" property in the OVRGrabber script in the 2 hands
Hope it helps you
You can use "OVRPlayercontroler"

OVRCameraRig not displaying both camera eyes in Unity player?

Unity 5.5.2f1
I'm trying to get started with making an Oculus app, following the instructions here, modifying a very simple scene I made. However, when I disable the MainCamera and drag in the OVRCameraRig, and run it in the Editor, I still only see a single frame, not these multiple eye views like in the picture. Player settings have "VR Supported" selected. Do I have something not set up right with the app? Or is the tutorial out of date or something?

Vuforia not showing what the webcam sees in Unity while still capturing the marker

I am making a first-person game using Unity and Vuforia. What I'm trying to achieve is that the user can have a marker attached on an object that can be held in his hand (a bottle, a book, or toy). So when he plays the game, he can hold the object in his hand, have the object facing the webcam, and move or rotate the object to control the first person character in Unity, e.g., tilt the marker-attached bottle in physical world so the first person character moves forward in Unity's virtual world. ps. by virtual world I mean just a basic first-person character walking around in a room, not the kind of VR that involves Oculus Rift.
I just played around with Vuforia. The good thing is I can choose my own image as the marker (looks like not every marker-based Unity plug-in can do this). But with Vuforia, can I create a virtual environment that's not showing the webcam's view? I did a basic Vuforia + Unity tutorial that only shows what the webcam captures and overlays a virtual cube on the detected marker. Summary of what I need is: not showing the webcam's view but still have the webcam functioning that it can capture the marker and I can use its position/rotation. In a way you can say I am just using the marker+webcam combo as a sensor used to control my virtual world activity.
Thanks!
From what I get it appears you want to use your marker as a target object to control motion in AR..
You'll have to build the functionality in Unity only as to what you want it to do specifically according to your set gameplay..
For example if you want a virtual dog to follow a target object, one easy way to do it is to provide an offset between the marker and the game Object and play a walking/running animation.
So it will appear as if the object is always following the marker, whereas in reality it is playing same animation at a constant distance.
As far as importing the marker is concerned.. It is no different than what you must have done with your cube..
In your Vuforia account Dev Portal:
Download the Vuforia SDK and import in your Unity asset folder.
Go to Liscense Manager under Develop tab and add a Liscense Key.
Now go to the Target Manager and add your images in the Databse which you want as target. (make sure the image quality is good for it to work prperly)
Now download the database and import it in your Assets folder in Unity.
Now go to your Liscense Manager again and copy your Liscense key and Open Vuforia Configuration under Vuforia Behaviour (Script) when you click on AR Camera, you'll find a dialog box there, paste this key there.
Save the build and run your game in Unity and bring the marker in front of the Webcam and it should work properly.
Hope this helps.

How to create VR Video player using Google Cardboard SDK for Unity

I just downloaded Google Cardboard SDK for unity. I am fine and able to create VR project. Setup is fine and everything is working fine.
I am noob at VR Apps. Just stepped in VR Apps.
I am planing to create my own VR Enabled Video Player for android, Just like the default Google Cardboard Youtube player.
Can any one suggest me a link or can guide me in developing this app.
Scott Driscoll's answer totally works. I had some initial problems getting the Easy Movie Texture Unity plug-in to work for me, but finally figured it out, and it works flawlessly. I now have 360-video running as a texture on the inside of a sphere on my iPhone 6. And I have to say, I didn't think it would happen.
For working on a Mac, here's what I did:
Download the Easy Movie Texture plug-in from the Unity Asset Store
Open the Demo Sphere demo scene from Assets/EasyMovieTexture/Scene
Create a new (empty) Prefab to your project, and drag the Sphere GameObject from the Demo Sphere scene onto the Prefab.
Reopen your Cardboard scene and drag the new videosphere prefab into your hierarchy.
Open your source 360-video in Quicktime
File -> Export -> 720p
Change file extension from '.mov' to '.mp4'
Drag your new mp4 file into your projects Assets/Streaming Assets directory. Note: don't import through the menu system, as this will force Unity to convert to OGG.
On the "Media Player Ctrl" script component of your videosphere GameObject, locate the "Str_File_Name" field and provide the FULL filename. Make sure to include the extension as part of the string, "mymovie.mp4".
Pretty sure that's everything. Hope it helps other folks stuck on this problem. Thanks Scott Driscoll!
One last note, you can only view the video on the phone, not in preview in the editor. It would be better if it didn't work this way, but really once the initial issues of resolution and placement are resolved, I don't really need to see the video every time I run the scene in the editor.
Here are the major steps for how we do this:
Add a sphere with an equirectangular UV mapping and inward facing normals around the camera.
Purchase a plugin to play a movie on that sphere’s texture. I recommend Easy Movie Texture.
Use mp4s or ogg vorbis files that are compatible with the platform. This is phone and OS dependent.
Full details: http://immersivetechblog.foundry45.com/2015/07/31/implementing-360-video-in-unity-for-gear-vr-and-cardboard/
I saw the answers above but all of them either required Easy Movie Texture Unity plug-in or coding your way through..
There's another easy solution to this as well which won't require you to buy that asset or code your way through..
Oculus provides an already built free sample framework which you can use without much trouble..
The solution below shows both how to create both a photo viewer as well as video viewer for Unity..
Building your 360 degree PhotoViewer:
Go to Blender and delete all the prexisitng objects (if any) and make an icosphere and increase the subdivisions to a point where it looks more like a sphere like 6 and hit Generate UVs (both these options are found in settings underneath the create tab in add to sphere) and go to edit and choose Flip Normals so that you can see inside out rather than outside inwards and save it.
Bring that icosphere saved file into your assets folder in Unity.
Download GoogleVR SDK and bring GoogleVR plugin into your assets folder as well.. (You can download it here: https://developers.google.com/vr/unity/)
Delete the main camera and directional light present in default.
Bring your icosphere asset into your project.
Bring GVR Main from your assets folder into your project: GoogleVR plugin -> Legacy -> Prefab -> GVR Main
Take any panaroma or 360 photo and bring it in your assets folder.
Take this photo in your asset folder and put it above the icosphere in your scene and hit play. You should be able to see your 360 degree photos.
Building your 360 degree MoviePlayer:
Step 1 same.
Now go to the Oculus developer console and download this file and bring this to your assets folder. https://developer3.oculus.com/downloads/game-engines/1.5.0/Oculus_Sample_Framework_for_Unity_5_Project/
Bring this file you downloaded above to your assets folder.
Find MoviePlayer in your assetsFolder in bring it in your project.
Bring the icosphere you downloaded into your assets folder as well and scale it a little bit so you can see correctly.
Copy the MoviePlayer sample script and Audio Source in the components of the MovieSurface from the project and add it in the components of the sphere in the scene, also get rid of the animator in the components of the sphere.
Bring the Movie Player material found in the Materials under Mesh Renderer in MovieSurface and add it on top of your sphere.
Now this sphere formed is your 360 degree movie player so store it as an asset in the asset folder.
Create a new scene, delete the directional light and bring your saved icosphere asset into this scene and move the main camera at the centre.
Delete the non required assets to clean up some space in your project other than MoviePlayer, Plugins and Streaming Assets.
You'll have to convert the desired mp4 into an ogv file as well for the plugin to play in VR and bring both the mp4 and ogv files into your streaming assets folder and change the MovieName and click Play. You should be able to see your 360 degree video playing.
*To play it in your devices, just go to build settings and choose the desired platform and delete all the scene and just Add Open Scene and click on the Virtual Reality Supported in Other Settings under Player Settings.
To play it in your android phone you need to download the GoogleVR SDK just like above and bring it in your assets folder and find the GVRViewerMain in the assets folder and bring it in the scene and uncheck the Virtual Reality Supported you did above and just build and run the whole thing in your device (You should be able to see the view in you game mode when you hit play in Unity).
You should be able to see the video in your respective gear.
There's also a video tutorial available but I'm only able to share only 2 links with my new StackOverFlow profile.
I can't help you with Unity, but in java, you can create a texture with OpenGL-ES:
private static int GL_TEXTURE_EXTERNAL_OES = 0x8D65;
....
GLES20.glGenTextures(1, textureHandle, 0);
GLES20.glBindTexture(GL_TEXTURE_EXTERNAL_OES, textureHandle[0]);
Use it to create a surface texture and a surface:
SurfaceTexture surfaceTexture = new SurfaceTexture(textureHandle[0]);
Surface surface = new Surface(surfaceTexture);
And then pass that surface to android.media.MediaPlayer:
MediaPlayer mediaPlayer = new MediaPlayer(getContext(), uriToMyMediaFile, surface);
Bind that texture to a square in your scene and call this every frame:
surfaceTexture.updateTexImage()
and the video will play when you call mediaPlayer.start();
If Unity allows you to write your own java code to run behind the scenes, this should work if you bind that texture to a surface from Unity.
If you have a video stream that you can't play with mediaPlayer (like a live video chat, etc), you can use the surface with android.media.MediaCodec as well, but there's a lot more setup work involved.
This has become very simple for Unity 5.6 and above.
You just need a sphere with its normals inverted which you can either find online or just go to blender and make an IcoSphere and flip its normals or you can use a shader to do the same on a normal sphere. In either case use an Unlit texture for the shader.
Add a Video Player in the component which comes default with Unity to this sphere.
Add any 360 degree video to this Video Player. You can also add an online link as well. And it plays consistently well throughout the range of platforms from GoogleVR to SteamVR.
The only downside is, it only plays monoscopic images/videos by default and there requires some tweaking to run stereoscopic images/videos.