This does allow for a precise region to trigger the mirror. I do prefer using LOD though, you just attach a LOD group component to your mirror object and set the distance at which you would like to cull the object. This means you need one less trigger in your world and it will always be clean. However in your example world this would have meant you render the mirror while being behind it while close to the wall. Though looking at a mirror from behind does not cost any performance from what i observe. Either way culling mirrors is really powerful, as often you may forget to turn it off when moving away.
The comment finally arrived... the one mentioning the far easier LOD method. I cringed a day or two after I uploaded when I realized it, but back then I was more focused on just getting started with videos ^^ I noticed when making some mirror pillows, that when you get past 90 degrees it stops updating the texture and you get that nasty tearing look, so it might explain the behind the wall performance savings.
Honestly the method In this video I use for my bathroom. As It is a teleport in one instead of a walk in so just having it turn off and on is nicer for how small the space is. So really does depend on the scene ye.
@@ruan7442 lod distance changes with fov too, so for anything you want to be consistent, this works better. The lod method is however simpler for non-presice distance toggles
Is there a way to do this same thing but instead of a mirror have it play a sound when someone enters the zone and then it stops playing the audio when someone leaves the zone.
Turn off the mirror when you make the world. You can also code it to set it to be off when the game starts (event, start --> gameobject, setActive(false) ), but its usually easier to just do it in unity. Also, disabling the mirror makes unity run faster too ^^
Most likely the script is crashing midway during the logic; hence why it won't work the second time to turn it off. Make sure you have filled in every slot in the inspector, but if you're still having issues, have a look at my video on debugging code (ua-cam.com/video/WSDWzINS0PE/v-deo.html), as this should show up pretty easily
@@PlayerBush001 I got it! all i had to do was restart unity! tysm tho! also i saw your world of pens and id like to know how you were able to do the weird cloud and space pens? also also having multiple pens with different shades of the colors cause when i did that it affect the other set of pens i put in there
haha, glad you liked it! (hope it wasn't too laggy for you ^^') The cloudy effect was made by simply changing the material on the pen to one with a 360 image input. I think I used pioyomi for that, but I would highly recommend finding a much more efficient shader for that (and quest compatible at that); given you only need a tiny feature. Also, as to how you change the colour, it depends on the pen you are using. If you are doing it for the popular QV pens (as I did back when I made the pen world), you will need a separate material for every pen. If you are using the final one I showed here, then you can simply change the colour via the udon behaviour component on each pen. This will greatly save on materials Hope that helps ^^
Is there a way to get a float value similar to the proximity value on physbones? e.g. You (LocalPlayer, Hand, Head, etc.) gets closer to the center of a sphere collider, it plays a controls a blend tree animator. I assume it's something like: Simplified Example: Get GameObject Transform, Get Player Transform, Somehow GetRemainder, Then SetFloat
Not that I am aware of. You can grab one of the standard humanoid avatar bones with 'playerApi, get bone position', but not any extra bones added to the model. The best I can think of off the top of my head would be to use the humanoid bones to approximate the location (using 'vector3, lerp' and 'quaternion, lerp' and giving the decimal percentage for how close to each side) and place an object where it connects. Then, have a duplicate of the physic bone from that location, and recreate it using dynamic bones unity asset, which can be used in worlds unlike phys bones (for now). So yea, the short answer is no, but the long answer is just mostly no ^^'
@@PlayerBush001 excellent stuff. I've dropped a freind request on vrchat as i'm making a huge nightclub world and want to add some sort of scary backrooms area.
To toggle a mirror, all you need to do is toggle on and off a gameobject, which I cover in this video: or you want to do it with a ui button, have a look at this video: However, if you want to do a low-high style one, perhaps this one made by Eternally Sami (ua-cam.com/video/zUALbgztU5Y/v-deo.html) would be closer to what you want ^^
I'm sorry, I don't remember doing different mirror qualities. If you want to do a falloff with different mirrors, perhaps you would be better off using a LOD component on the mirror, instead of doing via code
The asset likely sets up a bunch of variables using the event 'on start'. So it will need to be active when the game begins, otherwise those values may not be set up and the script will crash. That would be my guess anyways. You could try and make a simple script to turn off the TV a little after the game begins. To do so, use the nodes: event start --> udonBehaviour, send Custom event delayed seconds. Event Custom --> gameobject, set active (false) Hope that helps ^^
I figured out how to do it simpler. So what I did was I created an Empty and I grouped the USharp Video Player into the Empty and set the Video player to VISIBLE and the Empty to INVISIBLE and once I tested the world and went into the invisible trigger cube it turned the TV on and when I went out it turned it off. I hope that made sense... Thanks a bunch anyway!!! I'm sure your way worked just as well. ♥
ok my brain is smooth, is there anyway I can do this but instead of the player entering the target space can it be an item entering and instead of a mirror turning on can it turn off some colliders
yea... that's basically a rewrite of the whole code, but here is how I would do that: First, you want to swap 'on player trigger enter' with 'on trigger enter'. Then, instead of checking to see if it's the local player that entered the collider, you instead want to check to see if it was the target object. You want to store that object as either a public gameObject, or a public string value. If you store it as a gameObject, you want to grab the collision, and put that into a 'collision. get gameObject' node, and put that through a 'gameObject.equals' node. If you have it stored as a string, you instead want to do a 'collision. get gameObject' --> 'gameObject. get name' --> 'string.equals' node. Then put that through a branch, and then we need to say what happens if it = true. We then want to turn off our collider. There are two easy ways of doing this. 1st, we can turn it off by having a public collider value, and running a 'collider. set enable' node, and setting it to false. The second method is what Iconoclass did on his 'udon tutorial' video, where he use a 'gameObject. set layer' node, and set it to = 17. This is much better, if an object has multiple colliders. So yea... hopefully that at least gave you some headers as to where to look. For more info, I would ask in the vrchat discord, under the channel 'udon questions'. Hope that helps ^^
The script only tells the mirror to turn off when the player leaves the collider. When the player starts the game, they have never entered the script, so they cant leave it to turn it off. Toggle on or off the mirror in unity to be whatever you want the starting state of it to be, then it should work. Hope that helps ^^
@@PlayerBush001 yea I've understood my problem is locating the mirrors toggle for rendering it on and off but I found it, it's the little square next to the name of the object in inspector, Thank you
At 0:58 I created the script, that I would then build apon. If you don't have udon, you will need to install/ reinstall the vrchat sdk; or better still, create a new world with the vrchat creator companion app, that can be downloaded on the vrchat website. It is the new way to create and manage unity versions and sdk updates, and in the coming months, it will soon be the only way to make vrchat worlds
I make sure to say this in my later videos, but you can go rightclick, create node (the shortcut for this is spacebar) and them type whatever node you need Hope that helps ^^
I have a mirror that is activated by a button with 3 states. Off, high and low. How would I setup the same script but have it turn off the mirror as they walk away (if it was on already), and turn back on to the same state but only if they have pushed the button before. The button prefab im using is UDON AKSwitch if that helps. I am very new to this btw, so go easy on me lol
I could give you an efficient and satisfying udon solution, but I wont try and explain that here^^. If your just starting out, a simple (slightly hacky) way would be to put the mirror and collider into an empty gameObject. Then you can just use the button to toggle the empty and so when turned off, all the logic isn't running. To do the low/high, you could change the settings of the mirror, but you could just as easily duplicate the empty and have one mirror for high and one for low
You can't search it right from the start. First you need to search gameobject, then select it, and then search set active. If you want to search everything, you can hit tab instead of spacebar, but it is really slow and laggy
God damn Udon is so complicated... I know that there is so much more possible with this for people who knows how to code, but for an dumb guy like me it is so hard to set up even the simplest task... Why do Udon won't let me just duplicate an "Interact" node? Interact with Object to set active and then interact with Object to set inactive, but no... I need some weird way around this and don't know how. 😮💨 In the old system you could just made 2 triggers one for ON and one for OFF. Is there a easy way to do this? It is great when mirrors turn on automatically but for me it felt better when I could chose to deactivate it.
It seems that UA-cam search wasnt perfect in its suggestions, as this isn't a tutorial on making the standard mirror toggle, which is pretty easy in udon. If your wanting to add a toggle button to change from high to low quality mirrors, Sssami - サササミ did a video on it: ua-cam.com/video/zUALbgztU5Y/v-deo.html Udon is a coding 'language', so it can be rather confusing to start with, but it is sooooo much more powerful as you said. Now as for why you can't have two Interact event nodes, that is because unity doesn't know what item it should toggle first. This doesn't really matter with gameobject toggles, but there are times where, for example, you want to add 1 to a number, and then check if it is larger than another number. You need to know what one to do first. So the way you toggle two objects with Interact, is just by connecting the arrows slots up, stringing them all together. Check out my 'how to toggle multiple gameobjects' tutorial if your interested. All that being said, if you just want the old system, Cyan laser made an asset called 'cyan trigger'. its aim is to make sdk3.0, code much like sdk2.0; while still allowing you to use and import sdk3 assets to run alongside your sdk2 coding. Hope that helps ^^
@@PlayerBush001 Sorry my comment was a bit stupid, I was just so damn desperate because I tried Udon for the first level and had some time pressure. This made me almost insane, it feels so hard to learn this stuff for me. Thank you very much for your answer and the linked Video, this helps me alot.
Nah, I get it. Re-learning something you already know to do with another system, can be some of the most boring and frustrating learning you can do. I started this channel to try and help bridge the gap for newcomers, but there is still sooo much ground to cover. Glad I could help ^^
Well, that tutorial was as quick as me liking and subbing. Very nice work, thank you.
Thanks for the sub! Glad it helped ^^
This does allow for a precise region to trigger the mirror. I do prefer using LOD though, you just attach a LOD group component to your mirror object and set the distance at which you would like to cull the object. This means you need one less trigger in your world and it will always be clean. However in your example world this would have meant you render the mirror while being behind it while close to the wall. Though looking at a mirror from behind does not cost any performance from what i observe.
Either way culling mirrors is really powerful, as often you may forget to turn it off when moving away.
The comment finally arrived... the one mentioning the far easier LOD method.
I cringed a day or two after I uploaded when I realized it, but back then I was more focused on just getting started with videos ^^
I noticed when making some mirror pillows, that when you get past 90 degrees it stops updating the texture and you get that nasty tearing look, so it might explain the behind the wall performance savings.
can i download the script file?@@PlayerBush001
Honestly the method In this video I use for my bathroom. As It is a teleport in one instead of a walk in so just having it turn off and on is nicer for how small the space is. So really does depend on the scene ye.
Great video! Thanks a lot :)
Glad you liked it ^^
thanks for the tutorial
Glad you liked it ^^
Quality tutorial 👍
Glad you liked it! ^^
This was good tutrorial extaclty what I neeted
Glad I could help ^^
good video, i was having trouble because of the LOD method, but with that i can use the colider to say exactly when will active, not just by proxmity
@@ruan7442 lod distance changes with fov too, so for anything you want to be consistent, this works better. The lod method is however simpler for non-presice distance toggles
Is there a way to do this same thing but instead of a mirror have it play a sound when someone enters the zone and then it stops playing the audio when someone leaves the zone.
Sure! Just replace the gameobject toggle node/s with an 'audiosource, play' node
@@PlayerBush001 Thank You that worked finally I have been trying to do that for 2 days and struggled so thank you.
it starts with it active, how do I make it start with the mirror not active?
Turn off the mirror when you make the world. You can also code it to set it to be off when the game starts (event, start --> gameobject, setActive(false) ), but its usually easier to just do it in unity. Also, disabling the mirror makes unity run faster too ^^
I followed the tutorial step by step and everything i do it doesnt want to turn on. I went back and forth and still nothing why wont it turn on?
So i did something and it turns on but now it wont turn off when it needs to
Most likely the script is crashing midway during the logic; hence why it won't work the second time to turn it off. Make sure you have filled in every slot in the inspector, but if you're still having issues, have a look at my video on debugging code (ua-cam.com/video/WSDWzINS0PE/v-deo.html), as this should show up pretty easily
@@PlayerBush001 I got it! all i had to do was restart unity! tysm tho!
also i saw your world of pens and id like to know how you were able to do the weird cloud and space pens?
also also having multiple pens with different shades of the colors cause when i did that it affect the other set of pens i put in there
haha, glad you liked it! (hope it wasn't too laggy for you ^^')
The cloudy effect was made by simply changing the material on the pen to one with a 360 image input. I think I used pioyomi for that, but I would highly recommend finding a much more efficient shader for that (and quest compatible at that); given you only need a tiny feature.
Also, as to how you change the colour, it depends on the pen you are using. If you are doing it for the popular QV pens (as I did back when I made the pen world), you will need a separate material for every pen. If you are using the final one I showed here, then you can simply change the colour via the udon behaviour component on each pen. This will greatly save on materials
Hope that helps ^^
Is there a way to get a float value similar to the proximity value on physbones? e.g. You (LocalPlayer, Hand, Head, etc.) gets closer to the center of a sphere collider, it plays a controls a blend tree animator. I assume it's something like:
Simplified Example:
Get GameObject Transform, Get Player Transform, Somehow GetRemainder, Then SetFloat
Not that I am aware of. You can grab one of the standard humanoid avatar bones with 'playerApi, get bone position', but not any extra bones added to the model.
The best I can think of off the top of my head would be to use the humanoid bones to approximate the location (using 'vector3, lerp' and 'quaternion, lerp' and giving the decimal percentage for how close to each side) and place an object where it connects. Then, have a duplicate of the physic bone from that location, and recreate it using dynamic bones unity asset, which can be used in worlds unlike phys bones (for now).
So yea, the short answer is no, but the long answer is just mostly no ^^'
Interesting, I'll just stick to toggle triggers for now then. Thanks for the info! :)
I'd like to see a video that has contact or proximity triggers so I can throw some jumpscare mechanics into a halloween world
ah, sorry, meant to reply to this comment earlier.
Just released a video covering this, so I hope it helps ^^
@@PlayerBush001 excellent stuff. I've dropped a freind request on vrchat as i'm making a huge nightclub world and want to add some sort of scary backrooms area.
hola puedes hacer un tutorial de apretar un boton y que aparesca el espejo porfavor
To toggle a mirror, all you need to do is toggle on and off a gameobject, which I cover in this video:
or you want to do it with a ui button, have a look at this video:
However, if you want to do a low-high style one, perhaps this one made by Eternally Sami (ua-cam.com/video/zUALbgztU5Y/v-deo.html) would be closer to what you want ^^
did it step by step 3 different times same outcome, only seeing a LQ mirror and it never turns of and on when entering proximity
I'm sorry, I don't remember doing different mirror qualities. If you want to do a falloff with different mirrors, perhaps you would be better off using a LOD component on the mirror, instead of doing via code
I tried doing this with a USharp Video Player and I can't seem to get it to work.
The asset likely sets up a bunch of variables using the event 'on start'. So it will need to be active when the game begins, otherwise those values may not be set up and the script will crash. That would be my guess anyways.
You could try and make a simple script to turn off the TV a little after the game begins.
To do so, use the nodes:
event start --> udonBehaviour, send Custom event delayed seconds.
Event Custom --> gameobject, set active (false)
Hope that helps ^^
I figured out how to do it simpler. So what I did was I created an Empty and I grouped the USharp Video Player into the Empty and set the Video player to VISIBLE and the Empty to INVISIBLE and once I tested the world and went into the invisible trigger cube it turned the TV on and when I went out it turned it off. I hope that made sense...
Thanks a bunch anyway!!! I'm sure your way worked just as well. ♥
@@kojiiarfell nice one! Yea, that does sound easier ^^'
ok my brain is smooth, is there anyway I can do this but instead of the player entering the target space can it be an item entering and instead of a mirror turning on can it turn off some colliders
yea... that's basically a rewrite of the whole code, but here is how I would do that:
First, you want to swap 'on player trigger enter' with 'on trigger enter'. Then, instead of checking to see if it's the local player that entered the collider, you instead want to check to see if it was the target object.
You want to store that object as either a public gameObject, or a public string value. If you store it as a gameObject, you want to grab the collision, and put that into a 'collision. get gameObject' node, and put that through a 'gameObject.equals' node.
If you have it stored as a string, you instead want to do a 'collision. get gameObject' --> 'gameObject. get name' --> 'string.equals' node.
Then put that through a branch, and then we need to say what happens if it = true.
We then want to turn off our collider. There are two easy ways of doing this. 1st, we can turn it off by having a public collider value, and running a 'collider. set enable' node, and setting it to false.
The second method is what Iconoclass did on his 'udon tutorial' video, where he use a 'gameObject. set layer' node, and set it to = 17. This is much better, if an object has multiple colliders.
So yea... hopefully that at least gave you some headers as to where to look. For more info, I would ask in the vrchat discord, under the channel 'udon questions'.
Hope that helps ^^
I'm having problem still I ran this script exactly as shown and when I spawn in the world the mirror is automatically on still.
The script only tells the mirror to turn off when the player leaves the collider. When the player starts the game, they have never entered the script, so they cant leave it to turn it off. Toggle on or off the mirror in unity to be whatever you want the starting state of it to be, then it should work.
Hope that helps ^^
@@PlayerBush001 yea I've understood my problem is locating the mirrors toggle for rendering it on and off but I found it, it's the little square next to the name of the object in inspector, Thank you
I don't have the Udon graph script so i cant setup the local trigger do you know where i can get the script from
At 0:58 I created the script, that I would then build apon.
If you don't have udon, you will need to install/ reinstall the vrchat sdk; or better still, create a new world with the vrchat creator companion app, that can be downloaded on the vrchat website. It is the new way to create and manage unity versions and sdk updates, and in the coming months, it will soon be the only way to make vrchat worlds
I think you are using key shoortcuts because things are poping up with out you clicking on them =(
I make sure to say this in my later videos, but you can go rightclick, create node (the shortcut for this is spacebar) and them type whatever node you need
Hope that helps ^^
I have a mirror that is activated by a button with 3 states. Off, high and low. How would I setup the same script but have it turn off the mirror as they walk away (if it was on already), and turn back on to the same state but only if they have pushed the button before. The button prefab im using is UDON AKSwitch if that helps. I am very new to this btw, so go easy on me lol
I could give you an efficient and satisfying udon solution, but I wont try and explain that here^^. If your just starting out, a simple (slightly hacky) way would be to put the mirror and collider into an empty gameObject. Then you can just use the button to toggle the empty and so when turned off, all the logic isn't running. To do the low/high, you could change the settings of the mirror, but you could just as easily duplicate the empty and have one mirror for high and one for low
i dont seem to have "OnPlayerTriggerEnter"
nvm? it just now appeared xD
^^
I can't seem to get the "SetActive" node. Was there an update that changed this or maybe there is a problem on my end?
You can't search it right from the start. First you need to search gameobject, then select it, and then search set active.
If you want to search everything, you can hit tab instead of spacebar, but it is really slow and laggy
@@PlayerBush001 Oh I see thank you!
God damn Udon is so complicated... I know that there is so much more possible with this for people who knows how to code, but for an dumb guy like me it is so hard to set up even the simplest task...
Why do Udon won't let me just duplicate an "Interact" node? Interact with Object to set active and then interact with Object to set inactive, but no... I need some weird way around this and don't know how. 😮💨
In the old system you could just made 2 triggers one for ON and one for OFF.
Is there a easy way to do this? It is great when mirrors turn on automatically but for me it felt better when I could chose to deactivate it.
It seems that UA-cam search wasnt perfect in its suggestions, as this isn't a tutorial on making the standard mirror toggle, which is pretty easy in udon.
If your wanting to add a toggle button to change from high to low quality mirrors, Sssami - サササミ did a video on it: ua-cam.com/video/zUALbgztU5Y/v-deo.html
Udon is a coding 'language', so it can be rather confusing to start with, but it is sooooo much more powerful as you said.
Now as for why you can't have two Interact event nodes, that is because unity doesn't know what item it should toggle first. This doesn't really matter with gameobject toggles, but there are times where, for example, you want to add 1 to a number, and then check if it is larger than another number. You need to know what one to do first.
So the way you toggle two objects with Interact, is just by connecting the arrows slots up, stringing them all together. Check out my 'how to toggle multiple gameobjects' tutorial if your interested.
All that being said, if you just want the old system, Cyan laser made an asset called 'cyan trigger'. its aim is to make sdk3.0, code much like sdk2.0; while still allowing you to use and import sdk3 assets to run alongside your sdk2 coding.
Hope that helps ^^
@@PlayerBush001 Sorry my comment was a bit stupid, I was just so damn desperate because I tried Udon for the first level and had some time pressure. This made me almost insane, it feels so hard to learn this stuff for me.
Thank you very much for your answer and the linked Video, this helps me alot.
Nah, I get it. Re-learning something you already know to do with another system, can be some of the most boring and frustrating learning you can do. I started this channel to try and help bridge the gap for newcomers, but there is still sooo much ground to cover.
Glad I could help ^^
Its not working
I dont know why
Okay.. So how does it not work?
There are many different things you can miss, leading to it not working in many different ways