Best videos on Mixed_Reality Application Developing on UA-cam. Super clear, perfect speed, exhaustive explanation. Thank you and keep up the good work! I am thrilled to learn more :)
I've checked Udemy but I couldn't find a course explaining all this like the way you do it, your format is great. Would also like to read additional documentation on all the options you're showing us. Instant buy for me if you would create a full course on this.
Great videos, im using this info on my current app. I do have one question. You know when you put the headset on and a message comes up and says it has noticed new obstacles in your area? And it shows the red lines of the new objects, is that data available to use as well?
Unfortunately, I don't think that this 'obstacle detection' data is accessible (through the 'Unity OpenXR Meta' package or the 'Meta SDK'). At least, I'm not aware of any way to get this data.
All this is great, but the big question is if there's a way to develop an MR app for both the Quest and Vision Pro. If you want to develop for both platforms, what's the best approach?
Thank you for the great tutorial. I have a question. I followed along line by line from your script, but after I save and close, I don't see any "Toggle Planes Action" field. Instead I get this error message from unity: "error CS0246: The type or namespace name 'InputActionReference' could not be found (are you missing a using directive or an assembly reference?)". I also tried making the variable public but that did'n work as well. Would you happen to know what did I do wrong?
Same problem here. Checked my using statements, no problem there. I restarted the project, had to open it in safe mode, closed it again, opened it again and my scene was completly empty. It only made it worse, bc now most of the work is gone
I have the same problem :/ edit : i had a missing ; on a line.. when I started in safe mode, it showed the line where the compilation error occured., after changing and saved the file it worked.
Thanks for the great work! I have a question. I tried to follow along line by line from your script, but after I save and close, I don't see any "Toggle Planes Action" field. Maybe I have done something wrong in the script?
This is everything I have: using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.InputSystem; using UnityEngine.XR.ARFoundation; [RequireComponent(typeof(ARPlaneManager))] public class SceneController : MonoBehaviour { [SerializeField] private InputActionReference _togglePlanesAction;
private ARPlaneManager _planeManager; private bool _isVisible = true; private int _numPlanesAddedOccured = 0; // Start is called before the first frame update void Start() { Debug.Log("-> SceneController::Start()") _planeManager = GetComponent(); if (_planeManager is null) { Debug.LogError("-> Cannot find 'ARPlaneManager' :( "); } _togglePlanesAction.action.performed += OnTogglePlanesAction; _planeManager.planesChanged += OnPlanesChanged; } // Update is called once per frame void Update() {
} private void OnTogglePlanesAction(InputAction.CallbackContext obj) { _isVisible = !_isVisible; float fillAlpha = _isVisible ? 0.3f : 0f; float lineAlpha = _isVisible ? 1.0f : 0f; Debug.Log("-> OnTogglePlanesAction() - trackables.count: " + _planeManager.trackables.count); foreach (var plane in _planeManager.trackables) { SetPlaneAlpha(plane, fillAlpha, lineAlpha) } } private void SetPlaneAlpha(ARPlane plane, float fillAlpha, float lineAlpha) { var meshRenderer = plane.GetComponentInChildren(); var lineRenderer = plane.GetComponentInChildren(); if (meshRenderer != null) { Color color = meshRenderer.material.color; color.a = fillAlpha; meshRenderer.material.color = color; } if (lineRenderer != null) { // Get the current start and end colors Color startColor = lineRenderer.startColor; Color endColor = lineRenderer.endColor;
// Set the alpha component startColor.a = lineAlpha; endColor.a = endColor; //Apply the new colors with updated alpha lineRenderer.startColor = startColor; lineRenderer.endColor = endColor; } } private void OnPlanesChanged(ARPlanesChangedEventArgs args) { if (args.added.count >0) { _numPlanesAddedOccured++; foreach (var plane in _planeManager.trackables) { PrintPlaneLabel(plane); } Debug.Log("-> Number of planes: " + _planeManager.trackables.count) Debug.Log("-> Num planes added Occurred: " + _numPlanesAddedOccured) } } private void PrintPlaneLabel(ARPlane plane) { string label = plane.classification.ToString(); string log = $"Plane ID: {plane.trackableId}, Label:{label}"; Debug.Log(log); } void OnDestroy() { Debug.Log("-> SceneController::OnDestroy()"); _togglePlanesAction.action.performed -= OnTogglePlanesAction; _planeManager.planesChanged -= OnPlanesChanged; } }
Thankyou! Did you precede the '_togglePlanesAction' variable with the [SerializeField] attribute? Like this: [SerializeField] private InputActionReference _togglePlanesAction; Alternatively, you can also make the variable 'public' (as this should also expose the variable in Unity's Inspector) public InputActionReference _togglePlanesAction; Also, ensure that Unity is not in 'Play Mode' while editing scripts (or components in general). Hope this helps!
When I double click the Scene controller script it doesn’t open like yours. It asks me to select an app to open the file and gives me options such as notepad, word or windows media player. Do I have to add something to my project to get it to open in the project like yours?
Did you opt to install Visual Studio when you first installed Unity? If not, go back into 'Unity Hub', go to the 'Installs' section, click the 'cog' icon next to the Unity version that you are using, and select 'Add modules'. From there you can install 'Microsoft Visual Studio Community' Edition. If Visual Studio IS installed: In the Unity Editor, go to the top menu-bar and select: 'Edit' -> 'Preferences'. In the 'Preferences' window select 'External Tools'. Make sure that 'External Script Editor' is set to 'Visual Studio'.
Thank you so much I didn’t have it installed. I got it now. I don’t know anything about coding literally learning from scratch. I added the second line the “[serializefield] and “inputactionreference “ isn’t turning green. Does it need to?
@@samanthaah263 Its important to type variable Types exactly as shown in the example. For instance, make sure you type "InputActionReference" not just “inputactionreference“. Whether it turns green specifically, will depends on the color scheme you have set in Visual Studio (which could be different from mine).
Thanks for your tutorials, are very useful and clear, excuse me, I am overload 3d models using MRUK, I am having a little issues, the 3D models are moving to the left and the front (compared to the phyisical space (Passthrough)), they move very slow but it will make the app does not work well, do you had similar isssue? thanks in advance.
One question, after creating the Scene Controller Script I dont have the Toggle Planes Action inside the Inspector. Would you happen to know what did I do wrong?
is there any mask plane component that can mask virtual geometry behind it (or perhaps a stencil component)? eg. lets put a virtual door in a real room - wearing a quest3, we see thru the door into another room - a virtual 3d environment - but to the left or right of the door we see our room.. and when we enter the door - we enter a virtual space wider than the door.. looking back we see the door is now a portal back into the real room so how to mask the virtual room so only the door is seen when standing in the real room?
I keep coming back to your channel to see when part 4 will be out. Looking forward to it. Don't keep us waiting too long.
Best videos on Mixed_Reality Application Developing on UA-cam. Super clear, perfect speed, exhaustive explanation. Thank you and keep up the good work! I am thrilled to learn more :)
Thanks for the kind words! Working on the next MR tutorial right now. :)
THE BEST TUTORIAL FOR MR SO FAR
I've checked Udemy but I couldn't find a course explaining all this like the way you do it, your format is great. Would also like to read additional documentation on all the options you're showing us. Instant buy for me if you would create a full course on this.
Thanks for the encouragement! I'm actually seriously considering creating a Udemy course (which would certainly go into more detail than I do here).
Great tutorial. Thank you.
I love this series, thank you!!
Great videos, im using this info on my current app. I do have one question. You know when you put the headset on and a message comes up and says it has noticed new obstacles in your area? And it shows the red lines of the new objects, is that data available to use as well?
Unfortunately, I don't think that this 'obstacle detection' data is accessible (through the 'Unity OpenXR Meta' package or the 'Meta SDK'). At least, I'm not aware of any way to get this data.
Thanks for the reply. I appreciate your time.
Well explained as usual. Maybe Spatial Anchor could be next ?
Thanks! :) I'm currently making a short tutorial about physics interactions. But the next one will be 'Spatial Anchors' for sure!
Is this code file something that requires payment to access?
i need the script for plane detection mine wont work :(
Very well made video!
This tutorial is very useful.Thank you
How can I make it so that the planes are off when i first run the game? Instead of having them on and having to push a button to turn them off?
All this is great, but the big question is if there's a way to develop an MR app for both the Quest and Vision Pro. If you want to develop for both platforms, what's the best approach?
With Oculus Quest it is possible to achieve exact plane detection, automatically obtaining the angles of the physical object?
Thank you, well explained !
Thank you for the great tutorial. I have a question. I followed along line by line from your script, but after I save and close, I don't see any "Toggle Planes Action" field. Instead I get this error message from unity: "error CS0246: The type or namespace name 'InputActionReference' could not be found (are you missing a using directive or an assembly reference?)". I also tried making the variable public but that did'n work as well. Would you happen to know what did I do wrong?
Check the 'using' statements at the top of file. Make sure they include the following using directive:
using UnityEngine.InputSystem;
Same problem here. Checked my using statements, no problem there. I restarted the project, had to open it in safe mode, closed it again, opened it again and my scene was completly empty. It only made it worse, bc now most of the work is gone
I have the same problem :/ edit : i had a missing ; on a line.. when I started in safe mode, it showed the line where the compilation error occured., after changing and saved the file it worked.
Thanks for the great work! I have a question. I tried to follow along line by line from your script, but after I save and close, I don't see any "Toggle Planes Action" field. Maybe I have done something wrong in the script?
This is everything I have:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.XR.ARFoundation;
[RequireComponent(typeof(ARPlaneManager))]
public class SceneController : MonoBehaviour
{
[SerializeField]
private InputActionReference _togglePlanesAction;
private ARPlaneManager _planeManager;
private bool _isVisible = true;
private int _numPlanesAddedOccured = 0;
// Start is called before the first frame update
void Start()
{
Debug.Log("-> SceneController::Start()")
_planeManager = GetComponent();
if (_planeManager is null)
{
Debug.LogError("-> Cannot find 'ARPlaneManager' :( ");
}
_togglePlanesAction.action.performed += OnTogglePlanesAction;
_planeManager.planesChanged += OnPlanesChanged;
}
// Update is called once per frame
void Update()
{
}
private void OnTogglePlanesAction(InputAction.CallbackContext obj)
{
_isVisible = !_isVisible;
float fillAlpha = _isVisible ? 0.3f : 0f;
float lineAlpha = _isVisible ? 1.0f : 0f;
Debug.Log("-> OnTogglePlanesAction() - trackables.count: " + _planeManager.trackables.count);
foreach (var plane in _planeManager.trackables)
{
SetPlaneAlpha(plane, fillAlpha, lineAlpha)
}
}
private void SetPlaneAlpha(ARPlane plane, float fillAlpha, float lineAlpha)
{
var meshRenderer = plane.GetComponentInChildren();
var lineRenderer = plane.GetComponentInChildren();
if (meshRenderer != null)
{
Color color = meshRenderer.material.color;
color.a = fillAlpha;
meshRenderer.material.color = color;
}
if (lineRenderer != null)
{
// Get the current start and end colors
Color startColor = lineRenderer.startColor;
Color endColor = lineRenderer.endColor;
// Set the alpha component
startColor.a = lineAlpha;
endColor.a = endColor;
//Apply the new colors with updated alpha
lineRenderer.startColor = startColor;
lineRenderer.endColor = endColor;
}
}
private void OnPlanesChanged(ARPlanesChangedEventArgs args)
{
if (args.added.count >0)
{
_numPlanesAddedOccured++;
foreach (var plane in _planeManager.trackables)
{
PrintPlaneLabel(plane);
}
Debug.Log("-> Number of planes: " + _planeManager.trackables.count)
Debug.Log("-> Num planes added Occurred: " + _numPlanesAddedOccured)
}
}
private void PrintPlaneLabel(ARPlane plane)
{
string label = plane.classification.ToString();
string log = $"Plane ID: {plane.trackableId}, Label:{label}";
Debug.Log(log);
}
void OnDestroy()
{
Debug.Log("-> SceneController::OnDestroy()");
_togglePlanesAction.action.performed -= OnTogglePlanesAction;
_planeManager.planesChanged -= OnPlanesChanged;
}
}
Thankyou! Did you precede the '_togglePlanesAction' variable with the [SerializeField] attribute? Like this:
[SerializeField]
private InputActionReference _togglePlanesAction;
Alternatively, you can also make the variable 'public' (as this should also expose the variable in Unity's Inspector)
public InputActionReference _togglePlanesAction;
Also, ensure that Unity is not in 'Play Mode' while editing scripts (or components in general). Hope this helps!
When I double click the Scene controller script it doesn’t open like yours. It asks me to select an app to open the file and gives me options such as notepad, word or windows media player. Do I have to add something to my project to get it to open in the project like yours?
Did you opt to install Visual Studio when you first installed Unity? If not, go back into 'Unity Hub', go to the 'Installs' section, click the 'cog' icon next to the Unity version that you are using, and select 'Add modules'. From there you can install 'Microsoft Visual Studio Community' Edition.
If Visual Studio IS installed: In the Unity Editor, go to the top menu-bar and select: 'Edit' -> 'Preferences'. In the 'Preferences' window select 'External Tools'. Make sure that 'External Script Editor' is set to 'Visual Studio'.
Thank you so much I didn’t have it installed. I got it now. I don’t know anything about coding literally learning from scratch. I added the second line the “[serializefield] and “inputactionreference “ isn’t turning green. Does it need to?
@@samanthaah263 Its important to type variable Types exactly as shown in the example. For instance, make sure you type "InputActionReference" not just “inputactionreference“. Whether it turns green specifically, will depends on the color scheme you have set in Visual Studio (which could be different from mine).
Thanks for your tutorials, are very useful and clear, excuse me, I am overload 3d models using MRUK, I am having a little issues, the 3D models are moving to the left and the front (compared to the phyisical space (Passthrough)), they move very slow but it will make the app does not work well, do you had similar isssue? thanks in advance.
Are these animated characters? With static 3d models I've not noticed drifting while the app is running.
@@LudicWorlds No, actually they are static, but thanks for your feedback. I will keep trying.
One question, after creating the Scene Controller Script I dont have the Toggle Planes Action inside the Inspector. Would you happen to know what did I do wrong?
nvm, got it
Having the same issue here. Could you please explain what went wrong, and how you solved the problem?
@@JoseAfsharipour The problem is inside the script, once you have 100% what he has, it will work!
👍
is there any mask plane component that can mask virtual geometry behind it (or perhaps a stencil component)? eg. lets put a virtual door in a real room - wearing a quest3, we see thru the door into another room - a virtual 3d environment - but to the left or right of the door we see our room.. and when we enter the door - we enter a virtual space wider than the door.. looking back we see the door is now a portal back into the real room
so how to mask the virtual room so only the door is seen when standing in the real room?
Maybe this tutorial can help? (AR Portal Setup With URP) ua-cam.com/video/Y1lzXWD8NN8/v-deo.html
Is this code file something that requires payment to access?