If any of you are having trouble with the line shader at 17:49 because you're using 2020.2.1f1 and don't have 2D Render, do Create > Shader > Universal Render Pipeline > Sprite Lit Shader Graph. It's important for you to do Lit instead of Unlit even though Valem's is unlit, because if you do Unlit the end result will just be black/transparent for some reason. Also, you need to make sure you connected the A(1) value from the Sample Texture 2D output to the Alpha input for the fragment.
Hey since you're the nearest date I can find, I'm having troubles with the whole locomotion thing. So I ass the locomotion system and the teleportstion provider, but when I start only the teleportation provider auto syncs.. I also can't put my XR Rig into the Locomotion thing
For people doing this tutorial in newer versions of Unity/XRInputSystem where the Grip doesn't work to teleport: we use device-based scripts in this whole series, but the new default Ray Interactor is action-based. Just delete the XR-Controller (action-based) and create a new XR-Controller (device-based). Afterwards everything should work fine.
I would recommend sticking with action based as it is better optimised and is much easier to use if you plan on working with custom inputs, the easiest way to do this is to create a custom input and place it in the reference spot for select action. Hope this helps :)
If you run into a problem where the reticle keeps flickering, it's because you didn't listen to Valem and remove the colliders from *both* Cylinders. :)
I've been wanting to learn about Unity's URP shader graph so badly but have been kind of intimidated until I saw it broken down like this! Thanks a ton! Your teleport system looks great and polished! I love how you showed a simple "get it working" start of your video, but then went on to further polish and improve it!
Holy crap you pack a lot of info into 25mins! Thanks for this and your no bs approach, I was having the hardest time finding XR info that is relevant to the new XR system until someone referred me to your channel. Will do patreon once I get caught up!
If anyone is having a problem where they have to try to teleport multiple times to actually teleport, then I will share with you something that worked for me. When the controller's trigger is pressed over the teleportation area (or anchor), the teleport ray is set active and the player selects the teleportation area (or anchor). Teleportation is triggered when the controller's trigger is released and the player unselects the teleportation area (or anchor). The script that selects or unselects the teleportation area when the trigger is pressed or released is the XR Teleport Interactor. The problem is sometimes teleportation is not being triggered because we deactivate the teleport ray as soon as the trigger is released and before the XR Teleport Interactor can unselect the teleportation area (or anchor). Since the teleportation area (or anchor) is never being unselected, the teleportation is never triggered. To fix this, I added just 6 lines of code to the Locomotion Controller script: using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.XR; using UnityEngine.XR.Interaction.Toolkit; public class LocomotionController : MonoBehaviour { public XRController leftTeleportRay, rightTeleportRay; public InputHelpers.Button teleportActivationButton; public float activationThreshold = 0.001f; private XRRayInteractor rightRayInteractor;
I was able to solve this problem a different way. As Thomas mentioned, the teleport fails because the teleport ray is disabled before the teleportation occurs. If we can wait for the teleportation to complete before disabling the teleport ray, then the problem should go away. One way to postpone the disabling of the teleport ray is to wait for the next frame as the code below shows. Also, note that the teleport ray is enabled and disabled only when the teleport button was just pressed, or just released. using System.Collections; using UnityEngine; using UnityEngine.XR.Interaction.Toolkit; public class LocomotionController : MonoBehaviour { public XRController leftTeleportRay; public XRController rightTeleportRay; public InputHelpers.Button teleportActivationButton; public float activationThreshold = 0.1f; public bool leftTeleportEnabled { get; set; } = true; public bool rightTeleportEnabled { get; set; } = true; private bool leftButtonPressedLastFrame = false; private bool rightButtonPressedLastFrame = false; public GameObject leftTeleportReticle; public GameObject rightTeleportReticle; void Start() { InitializeTeleportRay(leftTeleportRay); InitializeTeleportRay(rightTeleportRay); } void InitializeTeleportRay(XRController teleportRay) { if(!teleportRay) { return; } teleportRay.gameObject.SetActive(false); } void Update() { ManageTeleportRay(leftTeleportRay, ref leftButtonPressedLastFrame, leftTeleportReticle, leftTeleportEnabled); ManageTeleportRay(rightTeleportRay, ref rightButtonPressedLastFrame, rightTeleportReticle, rightTeleportEnabled); } void ManageTeleportRay(XRController teleportRay, ref bool buttonPressedLastFrame, GameObject teleportReticle, bool teleportEnabled) { if (!teleportRay) { return; } // get the state of the teleport button InputHelpers.IsPressed(teleportRay.inputDevice, teleportActivationButton, out bool isPressed, activationThreshold); bool buttonJustPressed = isPressed && !buttonPressedLastFrame; bool buttonJustReleased = !isPressed && buttonPressedLastFrame; if(buttonJustPressed && teleportEnabled) { teleportRay.gameObject.SetActive(true); // this stops the reticle from appearing by the player's feet for 1 frame every time the teleport ray was activated teleportReticle.SetActive(false); } else if (buttonJustReleased) { // if we disable this object this frame, then the teleport won't work, so do it next frame SetActiveNextFrame(teleportRay.gameObject, false); } buttonPressedLastFrame = isPressed; } public void SetActiveNextFrame(GameObject gameObject, bool active) { StartCoroutine(SetActiveNextFrameHelper(gameObject, active)); } IEnumerator SetActiveNextFrameHelper(GameObject gameObject, bool active) { yield return null; // stackoverflow.com/a/39269012/1455558 gameObject.SetActive(active); } }
For anyone using a newer version of Unity, I was stuck with a white line that wouldn't move (was not dotted). I used the URP Sprite Unlit and made sure to add the A(1) from the Sample Texture 2D node to the Alpha(1) Fragment. It basically didn't have an alpha channel to make it see through. I encourage everyone to put different textures in the material and play with settings because I got some really neat effects from random pngs I had.
FYI for 1:27 its not under Devices -> ray interactor: do not choose action based. Rather it needs to be Device Based. Just a helpful tip for those who are lost :)
This series has been amazing so far. You are a great teacher. Everything is really well explained and I love your enthusiasm! You have helped me so much with my own VR project. Thank you!
If you're having issues getting the Dotted Line shader to appear in game (it remains invisible after following the steps exactly) and are on a later version of Unity, I managed to get it to show by changing the final node in the Dotted Line shader from "Sprite Unlit Master" to "Sprite Lit Master" (be sure to hook it up and set it to active). Note: I have no real knowledge of the shader and the ramification of that change in the grand scheme of things, but it gets the line to show up so its good enough for me for now
Complete code: using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.XR.Interaction.Toolkit; public class LocomotionController : MonoBehaviour { public XRController leftTeleportRay; public XRController rightTeleportRay; public InputHelpers.Button teleportActivationButton; public float activationThreshold = 0.1f; // Update is called once per frame void Update() { if(leftTeleportRay) { leftTeleportRay.gameObject.SetActive(CheckIfActivated(leftTeleportRay)); } if (rightTeleportRay) { rightTeleportRay.gameObject.SetActive(CheckIfActivated(rightTeleportRay)); } } public bool CheckIfActivated(XRController controller) { InputHelpers.IsPressed(controller.inputDevice, teleportActivationButton, out bool isActivated, activationThreshold); return isActivated; } }
Pretty much spent my entire day, taking notes and following along with small breaks in between to digest what I was learning and appreciate the VR'ness of things. You are the best bro. Keep it up. Hardly had any issues at all and things work great. Learned a ton.
For those who do not have the Universal Shader Pipeline option showing up when creating a shader for the reticle, you need to install the Universal RP in the package manager. Window -> Package Manager, then search for "Universal RP" and click install. Amazing Tutorials Valem!
Great tutorial! Tip: If you want to be able to teleport to one platform after initially pointing at another, remove the check on "Keep Selected Target" under Selection Configuration in the XR Ray Interactor component.
3rd time going through this tutorial series but first time getting to the third episode, took me a while to be ready to understand some of these things but glad I persevered!
You have to install Shared Graph from the package manager to be able to select it in the universale renderer list (11:15). And you also have to install the Universal Render Pipeline (Universal RP) from the package manager.
@@PhantomWolf93 LateUpdate will be run after Update. XRController check pressing button in a Update method so you need check pressing the button after XRController class, and with LateUpdate you will do it.
Great video, but i've got a little problem I don't see my reticle in Oculus Quest. I create prefab and drag into reticle field but when teleport is valid it doesn't shows up.
In later "XR Controller (Action-Based)" the action system has been changed so you cant set e.g. which action does what like you do at 6:10 . It seems you have to open the XRI Default Input Actions and adjust the mapping there. The actions listed there even have "Teleport Mode Activate", "Teleport Mode Cancel" and "Teleport Select" but none of these seems to be in the XR Controller component config, so a bit at a loss at how I can change this. I actually prefer to use e.g. the touch pad to show the teleport ray and release it to go there as both the grip and trigger are often used for other things.
@@jessynisas8753 , I found another tutorial by a guy called Daniel Stringer who goes over this and where you actually have to juggle two different XR Controllers, one for the teleport and another for interaction and where you have a script that triggers which one is active based on the state of the thumbstick (which is also a good teleport trigger and likely one that I will use myself).
If you notice, setting the Teleport Reticle to active each frame restarts the particle system, so it doesn't show any particles at all. You can skip setting it to active if it's already active with "if (!leftTeleportRay.activeSelf){ leftTeleportRay.SetActive(leftTeleportButtonState); }". If using the new Input System with a Player Input component to call a function, you may also want to enable/disable the target reticle Game Object in an if statement too, as I found that the Teleport Ray Game Object was disabled before the script got around to disabling the Target Reticle, so the reticle remains in place even after a teleport is executed. Hope this helps anyone else with the same issues. :)
For anyone that has a bug where they are unable to teleport to a valid area when beginning the teleport from an invalid area: Change "Keep Selected Target Valid" to false in the XR Ray Interactor
I followed the tutorial and did everything according to how you did it, but I've got a very minor bug in mine. The color-ramp cylinder on the target reticle seems to show a bit of z-flickering or whatever it's called on the base. (The flickering when two planes perfectly overlap) Any idea why, and how to fix it? Other than that, everything works the way it should, except that I left out the leftTeleportRay and only used the right side instead.
Hello there, everything worked for me, except when we change the default texture of the ray into the our one, in facts, when i set the material to "Default-Line" everything works fine, but when I insert the custom one it disappears, i followed the tutorial two times so everything I have is exactly equal to yours... Any ideas?
Everything works great except if I press the triggers on both controllers at the same time the teleport gets spammed and I quickly slide off of the teleport area.
The setup still works for me but I'm switched to action based controllers anyway. But I was unable to get the striped line working. No succees at all here. with the shader graphs dotted line I still see the original full line. Still excellent tutorial, this is only one detail.
@Valem - I cant get the Dotted line to work. There is nothing in the preview so I don't get any dotted lines appearing for the line of the reticle. Followed the tutorial exactly but can't see why its not working. An preview appears if I switch the shader to Sprite Lit but the material isn't used by the teleport Ray so its still a basic line.
ToastyHere 5 months ago If you're having issues getting the Dotted Line shader to appear in game (it remains invisible after following the steps exactly) and are on a later version of Unity, I managed to get it to show by changing the final node in the Dotted Line shader from "Sprite Unlit Master" to "Sprite Lit Master" (be sure to hook it up and set it to active).
whoever facing problem the Shader Graph doesnt turn transparent in Unity 2022.3.15f, go to Graph Inspector under Color Ramp (tutorial) >> Graph Settings >> Target Setting >> Active Built In & Universal >> Surface Type: Transparent >> Depth Write: ForcedEnabled. for both.Dont Forget to save asset.
Thank you for those tutorials! It helped me a lot. But I have a problem with the teleportation system. When I start the game, I am on top on the plane as I should be. The colliders work. But when I am teleported, my my entire rig is at the ground level, precisely where the raycast hit. And because I followed the next tutorial about the continuous movement, Im falling from the plane. I dont know whats going on^^
I had the "teleport stops working after adding the Locomotion Controller script part at the end" but in my case it was because my XR Controller Select Usage was set to "Trigger" while my Locomotion Controller script Teleport Activation button was set to "Trigger Button". They have to be the same.
Was met with compiler errors after copying the script in the last section. It could be due to the newest XR plugin and recent update. Everything else worked perfectly!
Hi, I have a ray which I want to pick up objects with. But instead of it snapping to my hand, I want the object to stay at the end of the ray at all times. What are your suggestions?
great unity XR tutorial i've ever see. btw i have 2 questions: 1. how to make the reticle only appear on top of the collision box (y axis only) 2. how to create a directional pointer to let the player facing that direction once teleported
I am only seeing a Ray Interacter (Action-Based) which does not allow me to link it to a controller. Is this due to an update or am I missing something?
Hey Valem! Great tutorial and really great channel, lot of useful things thank you! I have one problem with this solution: If you select an area (hold the trigger) and you move the teleporter to a different area before releasing the trigger UnityXR thinks your target is invalid so it does not let you teleport. I think this could be caused by the XR system, probably they intended to only select a hovered object and Unity XR does not let us change the selection. Can you think of any way to fix this? Thank you! David
Searched and read through all XR documentation that i could find and also tried to come up with own ideas, but I am simply lost due to having no idea where to start tbh: Got teleport up and running as shown in the video. I wanna do 2 changes though: 1) Instead of using the trigger button, i want to use every 360° direction of my controller sticks. Unfortunately the XR configuration menu only allows 2DAxis Up, Down, Right or left. Cant even set all 4 at once, only one. Opening up the script and trying to change it manually only throws a compile error at me. 2) If that works, i'd want to implement the same teleport orientation system, that Robo Recall uses. Upon pressing your controller stick in any direction, your teleport beam shows you where to teleport to. Then you can adjust your "forward after teleportation" direction by turning your stick. Pretty sure OVR plugin had a native feature, but can't find that in XR. I guess you'd have to write your own script for that, but I simply lost :(
You probably made a project with the normal 3D unity, not with the URP, if you did so recreate a new URP project. And if you already did and still do not have it, you can go to Window => Package Manager, and from the "In project" drop-down menu check if the Universal RP installed, also you hv to be sure the shader graph installed as well from the Unity Registery drop-down menu.
Hey great vid. I've followed along a good number of your tuts with great success. Thanks so very much for putting these together. I've got a small issue where my reticle stays after I teleport. Originally I had an issue whereby it wouldn't show up at all so now I've got it as a deselected game object (deselected in inspector, but still "in the game"). I'm not sure if I need to add something to the code to destroy the object, or an interactor event, or I've just got some setting wrong.
I had an issue where once the Locomotion controller script was added, I would be unable to teleport from one object to another. (Think a 3x3 grid of planes. I would be unable to teleport if I held the trigger while aiming at one platform, and moved my aim to another platform and let go). The solution to this was to *uncheck* "Keep Selected Target Valid" on the XR Ray Interactor script.
So after figuring out that you need to create a "Universal Render Pipeline" in order to make shaders work, and learning how to convert the whole project to that (fortunately they have made it rather easy) I then got stumped by particles that does not seem to auto play like Valem's does here. I can play them manually in the editor and see them working there but in the game, once the reticle is showing with the child particle system it doesnt seem to auto play or whatever is needed to get that going ... or perhaps there is something that needs to be turned on in order for it to render particles for my WMR device (Samsung Odyssey+)?
Hey, Im using the same version but have a different menu for the XR controller @2:00 . curious as to how to do it with the updated menu as ive hit a roadblock now. Cheers guys PS thankyou so much for the amazing videos valem :)
Sick series, I had a couple of problems with this entry though. 1: If I put the TP Reticle from prefabs, it does not spawn at all. 2: If I have the Locomotion Controller Script enabled, the teleport itself doesnt work but the lines appear/disappear correctly, at the same time if I have the Reticle from prefabs it doesn't appear, If I have the reticle selected from Hierarchy from a prespawned object it moves to the ray, but doesnt disappear/move again after. And 3: the custom ray/animated ray shader does not appear to work for me. I'm on unity 2021.2.9f1
The dotted line doesn't work for me, the material just shows up as magenta. I'm using URP's Shaders. I set the A(1) to A(1), I tried using lit and unlit sprite shader graphs but just purple. Even If if I just connect a blank color node to the shader it doesn't work. Any Help?
hi! ty for your tutorial! At the end of the tutorial, you drag the XR controller into the Locomation Controller Script...I can't drag anyting into that field. I wonder what I did wrong.
when i rotate my hand the recticle slightly rotates as well, its also showing up as an oval when both the numbers on the x and z scale are the same,. can someone help im on oculus quest
So you can see this issue at about 24:04, but when you start attempting to teleport in one area and then drag into a different area/anchor, the teleport is no longer valid (only when the hiding code is applied). Anyone know how to fix this? I've been trying to tweak the LocomotionController code for a bit to no avail.
I am getting an error in the locomotion controller code. "LocomotionController.cs(11,12): error CS1519: Invalid token 'float' in class, struct, or interface member declaration
Hey guys ! I made an update of this series on my channel Valem tutorial that you can find here : czcams.com/video/fM0k2n7u8sc/video.html
This is how you're supposed to learn: explain the content, then show it, let us test it to prove, and success!
If any of you are having trouble with the line shader at 17:49 because you're using 2020.2.1f1 and don't have 2D Render, do Create > Shader > Universal Render Pipeline > Sprite Lit Shader Graph. It's important for you to do Lit instead of Unlit even though Valem's is unlit, because if you do Unlit the end result will just be black/transparent for some reason. Also, you need to make sure you connected the A(1) value from the Sample Texture 2D output to the Alpha input for the fragment.
universal render pipeline dosnt show up
@@jetson35 what options show up?
Also if you have a discord, join Valem's server and ping me, same name Michael Moreno. We can chat there.
@@MichaelMorenoPhilosophy i sent you a message on discord with a picture
Thank you so much! Worked for me
Worked with me, you are a lifesaver.
Can’t believe how future proof this tutorial is, watching in 2022. Great job! Best toturials I have ever followed.
Hey since you're the nearest date I can find, I'm having troubles with the whole locomotion thing. So I ass the locomotion system and the teleportstion provider, but when I start only the teleportation provider auto syncs.. I also can't put my XR Rig into the Locomotion thing
Am on V 2021.3.0f1 if that helps
@@HazardIg I’m not available to help for the week sorry
I’m in a place without Unity, I don’t have a laptop
@@themaydayman Oh its all good, I ended up figuring it out by making a whole new XR Origin. Thanks tho :)
For people doing this tutorial in newer versions of Unity/XRInputSystem where the Grip doesn't work to teleport: we use device-based scripts in this whole series, but the new default Ray Interactor is action-based. Just delete the XR-Controller (action-based) and create a new XR-Controller (device-based). Afterwards everything should work fine.
God bless you, man!!!
super!!!
Thanks! Life Saving Comment.
I would recommend sticking with action based as it is better optimised and is much easier to use if you plan on working with custom inputs, the easiest way to do this is to create a custom input and place it in the reference spot for select action. Hope this helps :)
This worked!!!!
You are explaining things very well. I love to hear deep dive into those VR problematics.
well but way to quick
If you run into a problem where the reticle keeps flickering, it's because you didn't listen to Valem and remove the colliders from *both* Cylinders. :)
Thanks so much
goat thanks should have listened
Yep! This happened to me even though I told myself not to forget to remove the colliders! Got there in the end.
thanks god i found this comment
I've been wanting to learn about Unity's URP shader graph so badly but have been kind of intimidated until I saw it broken down like this! Thanks a ton!
Your teleport system looks great and polished! I love how you showed a simple "get it working" start of your video, but then went on to further polish and improve it!
Holy crap you pack a lot of info into 25mins! Thanks for this and your no bs approach, I was having the hardest time finding XR info that is relevant to the new XR system until someone referred me to your channel. Will do patreon once I get caught up!
Thank you man im glad you enjoyed the video 😊
If anyone is having a problem where they have to try to teleport multiple times to actually teleport, then I will share with you something that worked for me.
When the controller's trigger is pressed over the teleportation area (or anchor), the teleport ray is set active and the player selects the teleportation area (or anchor).
Teleportation is triggered when the controller's trigger is released and the player unselects the teleportation area (or anchor).
The script that selects or unselects the teleportation area when the trigger is pressed or released is the XR Teleport Interactor.
The problem is sometimes teleportation is not being triggered because we deactivate the teleport ray as soon as the trigger is released and before the XR Teleport Interactor can unselect the teleportation area (or anchor).
Since the teleportation area (or anchor) is never being unselected, the teleportation is never triggered.
To fix this, I added just 6 lines of code to the Locomotion Controller script:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.XR;
using UnityEngine.XR.Interaction.Toolkit;
public class LocomotionController : MonoBehaviour
{
public XRController leftTeleportRay, rightTeleportRay;
public InputHelpers.Button teleportActivationButton;
public float activationThreshold = 0.001f;
private XRRayInteractor rightRayInteractor;
Thanks, worked!
Thanks it got it to work, however, my teleport works on button down, not button up. I'm not sure where the problem is.
@@davidfu8174 The problem might be in your Teleportation Area script. Check that the Teleport Trigger field is set to "On Select Exit".
I was able to solve this problem a different way. As Thomas mentioned, the teleport fails because the teleport ray is disabled before the teleportation occurs. If we can wait for the teleportation to complete before disabling the teleport ray, then the problem should go away. One way to postpone the disabling of the teleport ray is to wait for the next frame as the code below shows. Also, note that the teleport ray is enabled and disabled only when the teleport button was just pressed, or just released.
using System.Collections;
using UnityEngine;
using UnityEngine.XR.Interaction.Toolkit;
public class LocomotionController : MonoBehaviour
{
public XRController leftTeleportRay;
public XRController rightTeleportRay;
public InputHelpers.Button teleportActivationButton;
public float activationThreshold = 0.1f;
public bool leftTeleportEnabled { get; set; } = true;
public bool rightTeleportEnabled { get; set; } = true;
private bool leftButtonPressedLastFrame = false;
private bool rightButtonPressedLastFrame = false;
public GameObject leftTeleportReticle;
public GameObject rightTeleportReticle;
void Start() {
InitializeTeleportRay(leftTeleportRay);
InitializeTeleportRay(rightTeleportRay);
}
void InitializeTeleportRay(XRController teleportRay) {
if(!teleportRay) { return; }
teleportRay.gameObject.SetActive(false);
}
void Update()
{
ManageTeleportRay(leftTeleportRay, ref leftButtonPressedLastFrame, leftTeleportReticle, leftTeleportEnabled);
ManageTeleportRay(rightTeleportRay, ref rightButtonPressedLastFrame, rightTeleportReticle, rightTeleportEnabled);
}
void ManageTeleportRay(XRController teleportRay, ref bool buttonPressedLastFrame, GameObject teleportReticle, bool teleportEnabled) {
if (!teleportRay) { return; }
// get the state of the teleport button
InputHelpers.IsPressed(teleportRay.inputDevice, teleportActivationButton, out bool isPressed, activationThreshold);
bool buttonJustPressed = isPressed && !buttonPressedLastFrame;
bool buttonJustReleased = !isPressed && buttonPressedLastFrame;
if(buttonJustPressed && teleportEnabled) {
teleportRay.gameObject.SetActive(true);
// this stops the reticle from appearing by the player's feet for 1 frame every time the teleport ray was activated
teleportReticle.SetActive(false);
} else if (buttonJustReleased) {
// if we disable this object this frame, then the teleport won't work, so do it next frame
SetActiveNextFrame(teleportRay.gameObject, false);
}
buttonPressedLastFrame = isPressed;
}
public void SetActiveNextFrame(GameObject gameObject, bool active) {
StartCoroutine(SetActiveNextFrameHelper(gameObject, active));
}
IEnumerator SetActiveNextFrameHelper(GameObject gameObject, bool active) {
yield return null; // stackoverflow.com/a/39269012/1455558
gameObject.SetActive(active);
}
}
THANK YOU THANK YOU
For anyone using a newer version of Unity, I was stuck with a white line that wouldn't move (was not dotted). I used the URP Sprite Unlit and made sure to add the A(1) from the Sample Texture 2D node to the Alpha(1) Fragment. It basically didn't have an alpha channel to make it see through. I encourage everyone to put different textures in the material and play with settings because I got some really neat effects from random pngs I had.
Thank you so much holy shit!
I love you
yea I keep forgetting unity changed that....
THANK YOU!! but for some reason it's gone when i change the speed to -2 D:
You're a life saver, thanks a million!
Amazing serie. I really wanted an updated tutorial for VR with Unity. I really expect to see a tutorial for setting up a full body avatar on XR.
that would be incredible, yeah!
This is by far the best tutorial I've seen. Such a dedicated tutor! Hats off!
This was great, took like 4 hours to actually build it but feels so satisfying at the end. Really good stuff, thanks!
facts!
FYI for 1:27 its not under Devices -> ray interactor: do not choose action based. Rather it needs to be Device Based. Just a helpful tip for those who are lost :)
legend
the myth
The funny thing about shader graph is that you don't need to know programming, you need to know programming and shader graph.
This series has been amazing so far. You are a great teacher. Everything is really well explained and I love your enthusiasm! You have helped me so much with my own VR project. Thank you!
If you're having issues getting the Dotted Line shader to appear in game (it remains invisible after following the steps exactly) and are on a later version of Unity, I managed to get it to show by changing the final node in the Dotted Line shader from "Sprite Unlit Master" to "Sprite Lit Master" (be sure to hook it up and set it to active).
Note: I have no real knowledge of the shader and the ramification of that change in the grand scheme of things, but it gets the line to show up so its good enough for me for now
tysm you saved me so much time haha
Legend!
Thank you man! I was having the same problem and you saved me :)
I upgraded my project to 2020.1.4f1 and had this problem. This fixed it after I struggled myself to fix it for 2 hrs damn it. Thanks!
Thank you! Worked great! :D
Complete code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.XR.Interaction.Toolkit;
public class LocomotionController : MonoBehaviour
{
public XRController leftTeleportRay;
public XRController rightTeleportRay;
public InputHelpers.Button teleportActivationButton;
public float activationThreshold = 0.1f;
// Update is called once per frame
void Update()
{
if(leftTeleportRay)
{
leftTeleportRay.gameObject.SetActive(CheckIfActivated(leftTeleportRay));
}
if (rightTeleportRay)
{
rightTeleportRay.gameObject.SetActive(CheckIfActivated(rightTeleportRay));
}
}
public bool CheckIfActivated(XRController controller)
{
InputHelpers.IsPressed(controller.inputDevice, teleportActivationButton, out bool isActivated, activationThreshold);
return isActivated;
}
}
THANKS! I had a line wrong in my code and this solved it :)
hippity hoppity your code is now my property
Dani: >:)
Pretty much spent my entire day, taking notes and following along with small breaks in between to digest what I was learning and appreciate the VR'ness of things. You are the best bro. Keep it up. Hardly had any issues at all and things work great. Learned a ton.
best unity tutorials yet
For those who do not have the Universal Shader Pipeline option showing up when creating a shader for the reticle, you need to install the Universal RP in the package manager. Window -> Package Manager, then search for "Universal RP" and click install. Amazing Tutorials Valem!
Great tutorial!
Tip: If you want to be able to teleport to one platform after initially pointing at another, remove the check on "Keep Selected Target" under Selection Configuration in the XR Ray Interactor component.
Great tip but I cannot find Selection Configuration nor "Keep Selected Target" anywhere in the XR Ray Interactor script. Where can I find it?
Thanks for this, didnt notice this issue until after I was done, nice to see their was an easy fix.
Wow you pack more content into 20 minutes than most would into a 3 hour video. It's so dense with info! Thanks! Liked and subbed.
Thank you for great tutorial. In my case, unity 2020.2, line renderer materials shader must be 'Sprite lit shader graph'. Hope help somebody.
It did help! thanks!
thank you
Thank you so much for posting this.
Thank you i was stuck there too much time haha
Didn't find in 2020.3
3rd time going through this tutorial series but first time getting to the third episode, took me a while to be ready to understand some of these things but glad I persevered!
You have to install Shared Graph from the package manager to be able to select it in the universale renderer list (11:15).
And you also have to install the Universal Render Pipeline (Universal RP) from the package manager.
The option did show up, but it also turned the entire world bright pink. . .
If you could make a video about how to make a working knife it would be useful for others trying physical combat or maybe a link to a tutorial.
Easy to follow. Tutorial has a good pace. Awesome!!!
This guy, this guy over here is a legend
i love this series, it's a necessity since vr moves so quick, do you have a list of the future parts of this series?
Great and very clear video, thank you!!
Thanks !
thank you for high quality material.
Love your tutorials, so enlightening - Thank you sir
God mode tutorials! Thank you very much :D
Valem sir, you have made some fantastic tutorials.
For those who can't teleport after adding if statements in update for checking active teleport ray, just chage Update with LateUpdate.
Awesome! Exactly the issue I ran into. Your solution solved may problem.
This solved my problem, but i dont know why. Can you explain why the Update doesnt work for me? Because Valem used the normal Update.
Thanks!
@@PhantomWolf93 LateUpdate will be run after Update. XRController check pressing button in a Update method so you need check pressing the button after XRController class, and with LateUpdate you will do it.
Great video, but i've got a little problem I don't see my reticle in Oculus Quest. I create prefab and drag into reticle field but when teleport is valid it doesn't shows up.
great series of tutorials so far i look forward to more :)
14:25 the tops on the bottom and the bottoms on the top
At the core, I've forgotten (in the middle of my thoughts)
you have future mate... you explain very well thanks
tutorials are fantastic, couldn't get shaders working properly but everything else is!
really good job on getting things in order. Keep it up!
Great tutorial. There's only 1 missing feature - to disable teleport into areas with an obstacle between ground and xr camera (e.g. below a table)
you can just put an object in spaces like that and make it invisible :)
this is amazing i was looking for a course its better than all of the course i have ever had
In later "XR Controller (Action-Based)" the action system has been changed so you cant set e.g. which action does what like you do at 6:10 . It seems you have to open the XRI Default Input Actions and adjust the mapping there. The actions listed there even have "Teleport Mode Activate", "Teleport Mode Cancel" and "Teleport Select" but none of these seems to be in the XR Controller component config, so a bit at a loss at how I can change this. I actually prefer to use e.g. the touch pad to show the teleport ray and release it to go there as both the grip and trigger are often used for other things.
I have the same issue, how can we do it now ?
@@jessynisas8753 , I found another tutorial by a guy called Daniel Stringer who goes over this and where you actually have to juggle two different XR Controllers, one for the teleport and another for interaction and where you have a script that triggers which one is active based on the state of the thumbstick (which is also a good teleport trigger and likely one that I will use myself).
The solution here : czcams.com/video/wGvh7Suo1h4/video.html
@@64jcl Thx you I just saw your comment !!
these r amazing tutorials
Thanks for the reminder at 8:24
Still with you at 20:10 and mind-blown *haha*, what a great tut
If you notice, setting the Teleport Reticle to active each frame restarts the particle system, so it doesn't show any particles at all. You can skip setting it to active if it's already active with "if (!leftTeleportRay.activeSelf){ leftTeleportRay.SetActive(leftTeleportButtonState); }".
If using the new Input System with a Player Input component to call a function, you may also want to enable/disable the target reticle Game Object in an if statement too, as I found that the Teleport Ray Game Object was disabled before the script got around to disabling the Target Reticle, so the reticle remains in place even after a teleport is executed.
Hope this helps anyone else with the same issues. :)
Thank you man. All I got.
First tutorial where I had no problems :D
for those in 2021 or later you have to put the right teleport ray inside the right hand or else it wont show up when you play the game
Mate! you're my hero today!
For anyone that has a bug where they are unable to teleport to a valid area when beginning the teleport from an invalid area: Change "Keep Selected Target Valid" to false in the XR Ray Interactor
How do you change from grip->trigger in an action-based setup?
you are a legend
You my friend, are an awesome teacher. Although I would probably watch this for the accent alone!
Muy bueno! gracias por estos videos!
Thanks a lot, very helpful
I followed the tutorial and did everything according to how you did it, but I've got a very minor bug in mine. The color-ramp cylinder on the target reticle seems to show a bit of z-flickering or whatever it's called on the base. (The flickering when two planes perfectly overlap) Any idea why, and how to fix it? Other than that, everything works the way it should, except that I left out the leftTeleportRay and only used the right side instead.
Have you figured this out? You may have to remove the collision layer.
I had that too, so I increased the Y position of the Cylinder so that it no longer collided with the ground.
Nice 👍🏻👍🏻👍🏻
Awesome
Hello there, everything worked for me, except when we change the default texture of the ray into the our one, in facts, when i set the material to "Default-Line" everything works fine, but when I insert the custom one it disappears, i followed the tutorial two times so everything I have is exactly equal to yours... Any ideas?
Resolved, worked fine using the "Sprite Lit Graph" instead of the ""Sprite Unlit Graph"
@@dodicenne12 Thanks dude, it works.
Thanks.
@Valem Can you comment it in video?
Helped me too, thanks mate !
Everything works great except if I press the triggers on both controllers at the same time the teleport gets spammed and I quickly slide off of the teleport area.
It's crazy how a setup from 2 month ago is no longer relevant. Let's hope that XR is here to stay
4 months before we used to import uculus integration from asset store and done! but look how it is now!
@@flurishart612 yeah!!!! But is quite for now!
The setup still works for me but I'm switched to action based controllers anyway. But I was unable to get the striped line working. No succees at all here. with the shader graphs dotted line I still see the original full line. Still excellent tutorial, this is only one detail.
@Valem - I cant get the Dotted line to work. There is nothing in the preview so I don't get any dotted lines appearing for the line of the reticle. Followed the tutorial exactly but can't see why its not working. An preview appears if I switch the shader to Sprite Lit but the material isn't used by the teleport Ray so its still a basic line.
ToastyHere
5 months ago
If you're having issues getting the Dotted Line shader to appear in game (it remains invisible after following the steps exactly) and are on a later version of Unity, I managed to get it to show by changing the final node in the Dotted Line shader from "Sprite Unlit Master" to "Sprite Lit Master" (be sure to hook it up and set it to active).
@@gunbowling2-vrgamedevlog682 Great! Thank you it works!
Thanks so much! Problem solved. :)
@@gunbowling2-vrgamedevlog682 thank you! problem solved it works
whoever facing problem the Shader Graph doesnt turn transparent in Unity 2022.3.15f, go to Graph Inspector under Color Ramp (tutorial) >> Graph Settings >> Target Setting >> Active Built In & Universal >> Surface Type: Transparent >> Depth Write: ForcedEnabled. for both.Dont Forget to save asset.
Thank you for those tutorials! It helped me a lot. But I have a problem with the teleportation system. When I start the game, I am on top on the plane as I should be. The colliders work. But when I am teleported, my my entire rig is at the ground level, precisely where the raycast hit. And because I followed the next tutorial about the continuous movement, Im falling from the plane. I dont know whats going on^^
this is exactly what happens to me its really annoyin
bro try increasing the size of you xr rig.It worked for me😇
I had the "teleport stops working after adding the Locomotion Controller script part at the end" but in my case it was because my XR Controller Select Usage was set to "Trigger" while my Locomotion Controller script Teleport Activation button was set to "Trigger Button". They have to be the same.
great tutorial!
Was met with compiler errors after copying the script in the last section. It could be due to the newest XR plugin and recent update. Everything else worked perfectly!
Hi, I have a ray which I want to pick up objects with. But instead of it snapping to my hand, I want the object to stay at the end of the ray at all times. What are your suggestions?
great unity XR tutorial i've ever see. btw i have 2 questions:
1. how to make the reticle only appear on top of the collision box (y axis only)
2. how to create a directional pointer to let the player facing that direction once teleported
I am only seeing a Ray Interacter (Action-Based) which does not allow me to link it to a controller. Is this due to an update or am I missing something?
I found it, Its now under "Device Based - Ray Inercater
@@justkeepdrone501 verrrryyy helpful thank you!!
Can you teach on how to making knives in the game?
hi, I'm stuck on the part about the dotted line, I followed every step I'm on a new version. someone plz help me.
Hey Valem! Great tutorial and really great channel, lot of useful things thank you! I have one problem with this solution: If you select an area (hold the trigger) and you move the teleporter to a different area before releasing the trigger UnityXR thinks your target is invalid so it does not let you teleport. I think this could be caused by the XR system, probably they intended to only select a hovered object and Unity XR does not let us change the selection. Can you think of any way to fix this? Thank you! David
Searched and read through all XR documentation that i could find and also tried to come up with own ideas, but I am simply lost due to having no idea where to start tbh:
Got teleport up and running as shown in the video.
I wanna do 2 changes though:
1) Instead of using the trigger button, i want to use every 360° direction of my controller sticks. Unfortunately the XR configuration menu only allows 2DAxis Up, Down, Right or left. Cant even set all 4 at once, only one. Opening up the script and trying to change it manually only throws a compile error at me.
2) If that works, i'd want to implement the same teleport orientation system, that Robo Recall uses.
Upon pressing your controller stick in any direction, your teleport beam shows you where to teleport to. Then you can adjust your "forward after teleportation" direction by turning your stick.
Pretty sure OVR plugin had a native feature, but can't find that in XR.
I guess you'd have to write your own script for that, but I simply lost :(
Just saw that Unity is using a new package called "XR Plug-in Framework" which changes things from this tut. Could be why you're having a problem?
@@andrewperez7844 kind of yeah. Definitely helped me a lot.
I had to rewrite some of my code, but so far I'm satisfied!
When I'm chosing the shader I don't have Universal Render Pipeline Unlit dose any one know how to get it I'm on version 2020.2.1f1
You probably made a project with the normal 3D unity, not with the URP, if you did so recreate a new URP project. And if you already did and still do not have it, you can go to Window => Package Manager, and from the "In project" drop-down menu check if the Universal RP installed, also you hv to be sure the shader graph installed as well from the Unity Registery drop-down menu.
@@durgam_sumerian7815 Thank you
Hey great vid. I've followed along a good number of your tuts with great success. Thanks so very much for putting these together.
I've got a small issue where my reticle stays after I teleport. Originally I had an issue whereby it wouldn't show up at all so now I've got it as a deselected game object (deselected in inspector, but still "in the game"). I'm not sure if I need to add something to the code to destroy the object, or an interactor event, or I've just got some setting wrong.
He didn't show that he made the reticle children of the ray. The ray should be parent of the reticle so it gets deactivated when the ray is too.
@@chewbaccabox Yes, that did it! Thanks so much :)
@@chewbaccabox Very thanks!
You're the best!
Great!!!! Looking forward to the next one!
love it
Nice!
I had an issue where once the Locomotion controller script was added, I would be unable to teleport from one object to another. (Think a 3x3 grid of planes. I would be unable to teleport if I held the trigger while aiming at one platform, and moved my aim to another platform and let go).
The solution to this was to *uncheck* "Keep Selected Target Valid" on the XR Ray Interactor script.
So after figuring out that you need to create a "Universal Render Pipeline" in order to make shaders work, and learning how to convert the whole project to that (fortunately they have made it rather easy) I then got stumped by particles that does not seem to auto play like Valem's does here. I can play them manually in the editor and see them working there but in the game, once the reticle is showing with the child particle system it doesnt seem to auto play or whatever is needed to get that going ... or perhaps there is something that needs to be turned on in order for it to render particles for my WMR device (Samsung Odyssey+)?
Hey,
Im using the same version but have a different menu for the XR controller @2:00 . curious as to how to do it with the updated menu as ive hit a roadblock now.
Cheers guys
PS thankyou so much for the amazing videos valem :)
Please make tutorial for distance grab in steavvr
Hi Valem, do you know how to create a second camera on the PC as a spectator view?
Awesome video although looks like will need a 1 week course on just "shaders". Can copy what you did, but it all looks a bit mystical. 😅
Sick series, I had a couple of problems with this entry though. 1: If I put the TP Reticle from prefabs, it does not spawn at all. 2: If I have the Locomotion Controller Script enabled, the teleport itself doesnt work but the lines appear/disappear correctly, at the same time if I have the Reticle from prefabs it doesn't appear, If I have the reticle selected from Hierarchy from a prespawned object it moves to the ray, but doesnt disappear/move again after. And 3: the custom ray/animated ray shader does not appear to work for me. I'm on unity 2021.2.9f1
Hello. I just cannot find all the menus that you show... For example in my programm i cannot see xr interaction toolkit
The dotted line doesn't work for me, the material just shows up as magenta. I'm using URP's Shaders. I set the A(1) to A(1), I tried using lit and unlit sprite shader graphs but just purple. Even If if I just connect a blank color node to the shader it doesn't work. Any Help?
I'm having an issue where my reticle is blinking. Not sure why
Remove the collider from the cylinder object on your reticle.
hi! ty for your tutorial! At the end of the tutorial, you drag the XR controller into the Locomation Controller Script...I can't drag anyting into that field. I wonder what I did wrong.
Did you figure out what went wrong, currently experiencing the same problem?
@@rudywebb9998 i can't remember. Sorry
Was it something in the code or just in unity?
when i rotate my hand the recticle slightly rotates as well, its also showing up as an oval when both the numbers on the x and z scale are the same,. can someone help im on oculus quest
So you can see this issue at about 24:04, but when you start attempting to teleport in one area and then drag into a different area/anchor, the teleport is no longer valid (only when the hiding code is applied). Anyone know how to fix this? I've been trying to tweak the LocomotionController code for a bit to no avail.
I am getting an error in the locomotion controller code.
"LocomotionController.cs(11,12): error CS1519: Invalid token 'float' in class, struct, or interface member declaration
Did you got any solution ?
Go to XR Ray Interactor and under Selection Configuration uncheck 'Keep Selected Target Valid'
Do a tutorial on how to add guns
SpicyCold he did
Chris NGW that was for oculus integration
my Teleport Reticles just stay on the ground if i let go of my teleport activation button while pointing at the ground did i miss something?
All the things I make using the Universal Render Pipeline comes out purple
Fix the material. Set shader to standard