#udon-general
59 messages Β· Page 67 of 1
For instance I'd like a world to have one track play during the day and a different one to play at night
yes
would this be possible with graph?
When I test with 2 clients, they are not in the same instance... how to fix? π¦
Yes, and it would look something like this
It also does kindof depend on what shader you're using, but usually the property you want is internally called "_EmissionColor"
Why does this happen? Why? This has to be some sort of bug
I don't understand why. I made so much testing on this and this is as far as I got with VRCObjectPooling.
I'm trying to use a synchronized object pool (just the active state of bullets) while keeping the position local per player, since the only actions that matter to me is when the bullet is fired and hits a target (this game being PVE).
The bullets fire properly from both client and owner when they are being used for the first time, HOWEVER, for some ungodly reason once the object pool loops back to the first object, they spawn on the player's item as expected and then get forced back to their actual spawn location?
This is position pull happens after OnEnable in the bullet, and it's seen as early as FixedUpdate. No other script is messing with the position of this bullets and the function that is enabling the bullets. Thinking that Return() is the guilty function here since the first time it spawns it goes through TryToSpawn() -> OnEnable() ->Collission() -> Return().... Loop back from pool -> TryTospawn()
I want to note that these objects do not have object sync since I want to save on bandwidth. Even if they could have, the position does not get reset properly and the bullets freeze in place for a good while when being spawned in with object sync on.
I really want to avoid using a custom pool since we dont have access to lists and queues yet.
thankyou so much, it kind of worked.. how do i get it to cycle colors? or does it do that automatically?
Currently it would just set the color of the emission to the one you specify, but you can do some further scripting if you'd like to do some transitions or other colors
any help with that too, im trying to make the emission cycle through colors with a slider
The most intuitive way to do that would probably be to add a public Gradient property to the UdonBehaviour so that you can easily edit it in the inspector
Then you'd use the sliders value (0 to 1) to sample a point on that gradient which would then give you a color to use for the color input on the Material.SetColor node
it wont let me connect gradient to anything
Try Gradient.Evaluate and give it the Slider.value aswell
Then it should return a color which you can then use for the SetColor node
like this?
Yeah, you should probably also plug the custom event nodes flow into Evaluate and then take the output flow and plug it into the SetColor node. Also, dont forget to set up the rest of the inputs for the Evaluate node.
lmao i feel like im doing this wrong sorry im new to udon
like this?
Oh, it's fine, that's why we've got chats like these, we're here to help after all. '^^
Yes, precisely, now you can take the gradient variable, pull it into the graph and plug it into the Evaluate node
You're almost done, now you just need to add a slider variable for the slider you've got in the world and then get the 'value' from it and plug that into the last input on the Evaluate node.
as in a gameobject? or UIslider?
UISlider ^^
Are you looking for something like DateTime.Now?
https://docs.microsoft.com/en-us/dotnet/api/system.DateTime.Now?view=netframework-4.8
wont let me plug slider into evaluate node
Now that you've got the slider, you actually need to get the 'value' (UISlider.value) from it aswell before plugging it into the float input
I guess. I just want a day skybox when its 6 am to 6 pm and a night skybox when it's not
There you go, now you can set up a nice gradient and have the slider blend between the colors. You should probably set the sliders max value to 1 aswell. ^^'
How about DateTime.Now.Hour then?
hey done all of that and its still not working
Is it not working? Does the slider work in the first place? What issue are you running into?
emission isnt changing its not doing anything,
it just stays white
Did you set up the gradient in the inspector?
Oh! You're not telling it what slider it should be referencing, you should make the UISlider variable public aswell. ^^
I would like to do manual syncing of a specific timer.
How would I go about syncing the timer of the same object somwhere else? (Currently using udonSharp)
Is there a way to reference the same variable of the same object on other clients using OnDeserialization?
omg thats why! ive done it thankyou!
Good job. ^^
thank you, im guessing if i wanted to do it to the lights aswell, i would just change a few things
Yeah, if you're planning on doing multiple materials driven by the same slider then I'd strongly advise looking into and learning about arrays
if I wanted to manually sync a variable of the on the same script/object in other clients on deserialization, any idea how I would do this?
where can i start with arrays?
was wondering if there was a way to modify a textmeshpro's maxvisiblecharacters with udon
to achieve an animal crossing text effect?
another thing, how would i go about simply setting the value of a bool?
if you want a bool variable then you can drag and drop it from the Variables Blackboard while holding Ctrl to make a "Set Variable" node. https://docs.vrchat.com/docs/udon-node-graph#drag-and-drop-for-variables
thanks!
Just wondering because this change has confused people multiple times by now but was this change intended?
Set bool requires a bool constant to set its value
yeah this confused me too
when the OnDeserialization event fires on non-owners, you can simply retrieve the value of the synced variable and it will be the new value. For a simpler approach, you can look at the way we Sync values in the UdonExampleScene using OnVariableChange events: https://docs.vrchat.com/docs/udon-example-scene#udon-variable-sync
Yeah, we lost the inline value when we remade the node to work with 'sendChange'. We intend to add the inline value setter back, you can file a Canny if you'd like to be informed when we do.
while you're here, any idea on how to change the maxvisiblecharacters on a textmeshpro asset?
been trying to figure this out all day
how do i access a public variable on a different udonbehavior on a seperate gameobject?
you would make a public Udonbehaviour variable so that you can reference the other udonbehaviour. Plug that into the inspector of your udonbehaviour component and then in the graph use a "GetProgramVariable" node
I put QvPen and usharp videoplayer on my world and I got this message
how can i fix it?
If I set the owner of a GameObject to a player, does the player also now own the children of that GameObject?
no, each gameobject is independent
have you imported udonsharp?
try making a new project and importing Udonsharp, usharp videoplayer and QvPen and see if the error occur
if the error shows up again you might want to reinstall unity 2019
just to rule out the issue
kill me
SO, i am trying to get an object to stick to the player, and have an ai follow that object. so far everything works, except that instead of moving the object (im using transform set position), it makes a copy every time its called. any ideas what might be going on? follower is set to an avatar, and follow is set to a plane (using it to see whats going on) that is set as the target on the avatar. here is my udon graph, and showing what happens in game. (happens with both "build and test" and hitting "build and publish" then going into the world) stacks are where i jumped btw.
also the otter in the back is the avatar to follow the plane, and the plane going through its neck is the one that is first instanced and supposed to be tracked onto the player
this given unitypackage do not working.
or maybe it's just working on VRC rather than playmode?
Has anyone else had trouble with the game not putting all clients in the same instance when running Build and Test lately?
someone know how i get the audio of the u# video player from Merlin to 2d global audio? I tried to change the audio sources to 2d but this didn't work quite
got it working
Is OSC input available yet for Udon graphs or U# scripts?
Effectively trying to find the Udon equivalent of this if it exists
https://docs.vrchat.com/docs/vrc_oscbuttonin
I'm gonna ask here too.. There is a Text on EVERY one of these buttons.. EVERYBODY ELSE can see it fine.. In Unity I can see it fine.. But my VRC just shows blank buttons and refuses to show the text π WTF
Like what the F ? xD Is my VRC broken
hi
since that i working in my udon world project
i know that beside's udon graph also exist some of sdk2 components as well
and that idk where really to put my question wether here or in world dev
but i decide to put it in here because i work in SDK-WO
maybe i also need to do some UG-(udon graph) implementation on my audio source as well idk
so with that being say'd...
i wonder there a way to make my short music or sound to be transitional-loop-sequenced
maybe i didn't enplane correctly
but what i want is ... is to make my music or sound plays in unlimited time without noticeable gaps between END and START
any idea how to make this possible ?
please help
any door lock systems out there? that's not a keypad?
How'd you like it lock?
well just so once ppl went trough - they can lock it from the inside i guess xD
kinda like the one in B club
That'd be more simpler than keypad. Would you like to do it yourself?
you make me sound like im asking to much xD. Was just asking if there was anything like that out there π
Well. No, sorry if I made it sound that way. I'm asking if you are going to create one so I can guide you. I don't really have set of prefab already made since I usually create one myself.
Im sorry aswell π . But yeah would be nice to learn how to make it π
So what do you already have now?
Also is the door a physical door that swing when open, or teleportation door?
Just fyi i do not have a lock system - wich i why im here π . - It's an animated door
Likely you'd need a door first then implement locking. So first thing is trying to create a script to open-close the door when interact, without locking
This way you will be able to implement locking later on top of existing door
ohhh ill try that . swing doors a they synched?
Yes if you'd like to.
well kinda want that. course i heard that Animated door cant be synched
That's an issue about animator itself playing a long animation. But your door only has 2 states and switch back and forth just for a short time with animator parameter, so that'd be no problem
wait then how do i do so ?
You'll need one synced variable for udon, preferably a bool. Then you have Interact event to toggle the bool between true and false, then OnDeserialization event, have the bool variable set to animator parameter
Could you show what you have for the door animation also?
the animation it self or the animator?
Animator first
can somebody explan's what those nodes mean?
That's good you're already have it setup
Those are event node when you click/pull trigger on held item.
So now we can focus on creating udon behavior. You have to create an udon behavior like I've described earlier
@coarse parrot
ah so that's like for example...
when i hold my gun and press mouse button or trigger button it will call a trigger to shut or not
because key up means shut and key down means dont shut
is that it?
kinda like this - ive just have to put in a bool for the synch?
Down is when your start pressing mouse left button/trigger, up is when you left up the button/trigger. Both will fire only for one frame.
@coarse parrot
oh so it's oposite ok then thanks
Almost. You'd need to create a bool on the behavior itself then use that bool to set to animator.
so i need to make a behavior and then a bool for the animator?
You need bool in both of udon behavior and animator
possible to see an example?
This is where you can add a new variable to the udon behavior. Click on + and select bool
okay done it xD
Also expand the arrow and set the variable to synced.
only need to set it to synced ? right
I think you could make it public too, for future use.
okay π sorry for being a pain still new to the udon stuff xD
I think is should make you and example that'd be much fasterπ
yeah xD im sorry mate xD
Something around this
thats for locking to?
Yes. But only for door side. There will be another udon behavior handles locking interaction.
imma try it out π . - sry was eating dinner xD
This should be able to handle door interaction for open and close, also synchronization of the door state.
The string Box is that a variable?
having issues finding it xD
Search the node under string type, it's const string node
Okay so ive set that up
Try if the door is working
hmm does not work xD
Mind showing your udon setup?
setup up like urs. wait did you want me to implement into the one i got π ?
There could be some different so just making sure
You named a parameter in animator x2 Open?
yeah becourse of my animator ?
That's weird you name it that way
how come?
gimme a min
so renamed the one in animator just for Open
Oh You didn't have a collider on the door
i need to put it on?
Yes. Otherwise it won't detect the interaction
what if the interaction should be a button ? just asking xxD
That can be done too, but need to move interaction node to separate udon behavior on a button
hmm still not working
Could you interact with the door at all?
nope wouldt let me
Likely it's because of how you setup the AutoDoor object. How is it look like now?
yeah did set the door up in a object
Does the collider cover the door?
this is how
- ehm yeah seems like the box i covering both doors
Collider has to be in the same object with udon behavior
how would i go about checking if the player has pressed right trigger on their controller? similar to this
it is ^^
The collider is still a default cube size. Would that match with your door?
2 secc
Also if the door itself has a collider(to prevent player walking through), you will need to extend udon collider to cover the door collider too.
so saw that it spawend the box collider somewhere els. so had to fit it - tried then to interract with it (worked but got a udon error)
Do you get more information about the error? What did it say?
it dosent say much xD
if you click on it, it will expand below
sounds like the animator isn't specified
Check again if the animator is assigned on udon behavior component
Ah you didn't link animator variable into SetBool node
So do I
Make it like this
worked now xD
just couldt move past the collider xD
Now change the udon collider layer to Walkthrough. Do do have more colliders in child objects to prevent player from passing when a door is closed?
yeah the one on the doors themself
So changing the object layer to Walkthrough for only parent object should be sufficed.
okay ^^
worked fine - so whats next π ?
Add a new udon behavior to the locking button
yup
Also set up a collider the same way with the door
it has a sphere collider if thats good enough xD
capsule xD *
okay testing it π
worked like a charm . - so how do i set the open and close to a button aswell?
Create another udon with same graph as the locking one. But change string to ToggleOpen
ohhh
You may need to remove Interact node from the main door udon as well.
wich was that?
The main door udon that has an animator
sheeesh it works π . im so greatfull for the help π
Another question π . - is it possible to make "soundproff" rooms? xD
should be possible. You can set voice distances to 0 locally for players to essentially mute them. As long as you're careful with how the voice distances are being set, you could mute players in a certain room to all players not in that certain room
I'm having trouble after upgrading to unity 2019. Everything went well except unity no longer recognizes VRCUrlField as a valid class and gives me this error
'VRC.Udon.Editor.ProgramSources.UdonGraphProgram.UI.VRCUrlField' is missing the class attribute 'ExtensionOfNativeClass'! anybody know what might be causing this? I already tried deleting the library and regenerating it, but I can't get url fields back
how would i go about checking if the player has pressed right trigger on their controller? similar to this
how do you mean π
Ok, I'm really confused. I tried to set up the Udon network, and I did this set up many times, but for some reason this one won't work
it works fine for other objects, but not this object. It's a plane
Should be easier if you make a teleportation door to a room very far away from the main section.
true xD
but even that i had issues with xD
It's an event that gets called, not an input check like keypresses are. I think its called InputUse
You can read the input of a Player's controller in a unified way across all platforms by using Udon Input Events. These events will work correctly even when the player has remapped their controls. There are currently two types of events - Button and Axis, which include boolean and float values. Eac...
nobody? alright, i will figure it out myself
@twin hedge what's the problem? that the network isn't syncing the toggle?
thank you!
I'm getting this
oops bad crop. hold on
what does this mean? I googled it and found nothing helpful
haven't seen this before, but I think it's saying you have a node somewhere in your udon graph that is missing an integer input if i had to guess
hmm
but I've used the same network many times and they never failed me
I tried other objects and they worked fine. but this object, which is just a plane, won't work with the udon network
If that's your entire udon graph then it seems like something just broke in unity. You may want to save everything and reopen the project, and maybe reimport the udon graph asset
or you can try exiting the scene and reopening it
alright
nope it still doesn't work
Yeah, it has to do something with the object being plane cuz I replaced it with another object and it worked fine
I put it in an empty object and it works now. I guess I'll put them in the empty objects
You having issues with the object being a plane just gave me an idea to fix this. Trying with a cube instead
Oop, forgot to remove the collider lol. OFF TO SPACE I GO!
Trying again
Nope, still broken
Anyone got an idea on whats happening? (Check the replied to message above)
wait you're using vrcinstantiate but you don't want it to copy the object?
that's exactly what vrcinstantiate does
if you don't want it to copy, just remove the instantiate
No, I want it to instantiate ONE then move that with the player
The only time it should run through the instantiate is once
do you need these objects to have any synced variables or network events?
I just need an ai to follow the object
Everything works fine other than it multiplying
do you need to make a new AI for each player?
Yes
so then you need to vrcinstantiate the AI as well
I have an on player join that will instantiate one ai, and should instantiate one object
it's not working as you'd expect because you're pulling variables from a completely different flow path
you have your update loop pulling the gameobject from the instantiate, which causes the instantiate to happen again on update
Ok
if you want the instantiate to happen once and then store a reference to that object, you need to add a variable and set that variable to the gameobject you get from the instantiate
Ok
the same problem is in onplayerleft, you're also pulling variables from a different flow path. That's just not intended behaviour
but if you set the variable to a new copy every time a player joins, then it will only update for the last person that joined. So you'll need to add an array of these objects, use a for loop to find an empty spot, and put the new object in that spot.
Then on update, for loop through the array to update all of them.
And then onplayerleft, for loop through to find the matching player and remove theirs
Ok
Ty
Wait how do I se- nvm got it
Ok, so, I'm having a bit of trouble figuring out how to do that with the node graph
Well I froze vrchat, umm
And now I crashed unity lol
I cant figure out how to do all this in the graph
which part?
Like all of it lol
so first is you need an array of gameobjects
an array can contain multiple things, but it cannot be resized so you'll need to make the default size big enough to handle all the players your world will ever have
which is the soft cap * 2 + 2, so if you have 16 soft cap, set the array to 34 length
Ok, so I need one thats 82 then bc its 40, also thank you soooooo much for your help before and in advance
Now that the game doesn't freeze when I build and test im going to build and publish as public so you and others can check it out in-game
I'm gonna restart with another graph so I don't loose my progress, but can copy my work when I figure it out
What does this node do
it's useless. It's auto-generated, these things happen
Thanks - is there a useful datatype to just store a transform as code or do I have to just save three vector3s
I want to hardcode some position/rotations to snap to when i drop a pickup near it
huh? You mean.... a transform?
Well, I have a transform varible that I'm trying to set on Start with my hardcoded position and rotation, but it wants an actual instance, rather than letting me just set values to it. I guess I'm just looking for a Pos/Rot/Scale bundle datatype
oh, that's kinda what a matrix4x4 is
Perfect, that's what I was missing
I am very new to Udon, how can i make a interaction like a pool table update for both quest and pc? Cause i uploaded my world, works fine in both platform separately however when we try to play pool, I click to start the game but the Quest user cant see the UI to join the game. Anyone know of a fix? Thx and much love
whenever you're syncing anything between two platforms, you need to make sure that every object is ordered exactly the same between the two versions. If you delete objects on the quest version, it will assign network IDs differently and it won't be able to sync properly
Could it be that i copied the Scene from the PC Version to a New Scene for Quest? Or is that okay as long as the Hierarchy is the same?
it's fine as long as the hierarchy is the same
but it's possible that copying it changed the hierarchy
Going through it now... looks it did change the hierarchy. If i upload to quest on the OG Scene would it screw everything up that i did on pc when i switch back to the PC Platform on Unity?
Copying it to a new scene would mean it's in the same project and therefore has unique identifiers across the board for everything.
Ie; The Pool Table in the PC Scene isn't the same as the Pool Table in the Quest Scene because they're both part of the same World Project and (conventionally) they are both in a game that can transition between the two scenes.
Okay, ill try it out tommorow, THANK YOU to both of your help!
I am use gonna upload the OG Scene and delete the Quest Scene
hi , i have an idea for a vr chat world but it needs something that i am not sure where to start learning. i want to make a simple computer in vr , nothing amazing just something that would let you select "folders" and scroll through text documents. have a few ideas how to do some of it but no clue how i would do scroll threw text with out doing some really dull stuff "if down arrow button is pressed and on page 3 go to page 4" kind of thing, ied love to use the UI menu but cant find anything involving a scroling menu
Is it possible to return the Start Colour of a Particle System in Udon? I've looked through the search but it doesn't seem to be there.
Nevermind, found it! It's in ParticleSystem Main Module.
You don't have UdonSharp installed.
SORRY IF THIS IS THE WRONG CHANNEL! So I was wondering if this fix is still good for the new update? I have run into an issue where a a quest player grabs a QV Pen and so does a PC Player, they both draw a line however both lines are deleted after then pen is released. The line stays for user but not the βviewerβ. Or Do i need to add a script?
Silly Question. UndonFlat converts Graphs to sharp. Anyone know of a tool that does the opposite?
I have 4 audio i want it to play random when i click interact how is this done?
Is there a way to get the player's current computer time or timezone?
I think theres a prefab for it from VRCPrefabs
Thank you
you mean something like this? https://github.com/MerlinVR/UdonSharp
Hello i got a question how do i make my world quest compatible when i test it everything is miss textured
no, i very much know what udon sharp is, i exclusively use it. I was looking for something that will convert it to a graph.
It'd be better if you export udonsharp as udon assembly when you want to export your asset
thats not what I am after, I need to see what my scripts look like in udon without having to play with disgusting noodles.
Maybe, I asked in the wrong channel, UdonSharp nor C# or Unity is new to me. We have a tool that will take the graph and convert it to udon sharp, I was just curious if we had something that took sharp and converted it to a graph π
Sorry for disturbing sir. question regarding the "Udon" you helped with yest today - can i lock a tp to? or do i have to change some thing?
Yes you can lock tp
anything i need to change?
So there wont be opening state for the door any more
And locking variable will be used to determine if TeleportTo should be executed or not.
okay π
I may ask a question here, why I can't set UI text on Update()?
This is the code, using U#.
void Update()
{
int spawned = 0;
foreach (GameObject gobj in DiceObjectPool.Pool) if (gobj.activeInHierarchy) spawned++;
limitText.text = spawned.ToString("D2") + "/" + DiceObjectPool.Pool.Length.ToString("D2");
}
This is what it should be. (Test using CyanEmu)
So i can remove the open ones?
Yes
System.TimeZoneInfo.Local in case you havent found it yet
is there a way to set scale/change scale of an object in udon?
i only see pos and rotation
localScale
but that's only local I assume? what if I want it to be global
Ohh yeah i forgot lossyScale is readonly
To scale an object "globally" you need a 3x3 Matrix
Since rotations have to be taken into account, which skew the euclidean space, which makes scaling complicated.
Yeah spatial mathematics are sadly not super straight forward.
Thanks for answering me
You dont really need global space scaling if all the parents are set to the default 1,1,1 though, do you?
anything els i have to change?
Yeah ideally you should never have non-uniformly scaled parents. Since that can mess up a bunch of things. But sometimes thats unavoidable.
Networking.SetOwner(Networking.LocalPlayer, this.gameObject);
Debug.Log("took ownership");
menuOn = false;
scoreDisplay = true;
Debug.Log("reuqesting serialization");
Debug.Log(Networking.IsClogged);
Debug.Log(Networking.IsNetworkSettled);
RequestSerialization();
Debug.Log("requested serialization");
OnDeserialization();
Debug.Log("Sending out start game network");
SendCustomNetworkEvent(NetworkEventTarget.All, "startGameNetwork");
Debug.Log("Sent out start game network");
``` I have no idea what I'm doing wrong. Networking.IsClogged returns false, Networking.IsNetworkSettled returns true, the event goes through fine, `menuOn` and `scoreDisplay` are both synced variables, it says it transferred ownership successfully in the log, yet nothing is getting deserialized. It doesn't even call OnDeserialization on the other client, yet it works fine on this part of my code (same networked object) ```cs
Networking.SetOwner(Networking.LocalPlayer, this.gameObject);
selectedSong = localSelectedSong;
masterId = Networking.LocalPlayer.playerId;
joinedPlayersIds = new int[] { Networking.LocalPlayer.playerId };
RequestSerialization();
Debug.Log("Requested serialization");
selectionMenu.SetActive(false);
songSelectedMenu.SetActive(true);
updateSongSelectedMenu();
startJoinButtonText.text = "Start";
Can udon make temporary named variables within the scope of the event or do they need to be persistent across all events?
Udon cannot dynamically allocate variables on the internal heap. So yes, all variables ever used have to be declared and allocated upfront.
So when udonsharp seems to be doing it is that just trickery and they are global?
yes. At least I think so. I havent looked too closely at how UdonSharp treats scoped variables recently
SORRY IF THIS IS THE WRONG CHANNEL! So I was wondering if this fix is still good for the new update? I have run into an issue where a a quest player grabs a QV Pen and so does a PC Player, they both draw a line however both lines are deleted after then pen is released. The line stays for user but not the βviewerβ. Or Do i need to add a script?
?
hi , i have an idea for a vr chat world but it needs something that i am not sure where to start learning. i want to make a simple computer in vr , nothing amazing just something that would let you select "folders" and scroll through text documents. have a few ideas how to do some of it but no clue how i would do scroll threw text with out doing some really dull stuff "if down arrow button is pressed and on page 3 go to page 4" kind of thing, ied love to use the UI menu but cant find anything involving a scroling menu
don't look for vrchat tutorials on ui setups. The only thing required for vrc is the vrc ui shape component that gets attached to the canvas (minor stuff like setting navigation to none, and changing the layer to default if it sets itself to UI). Other than that, you want any Unity 3d ui tutorial which the net is flooded with π
ooh thanks i will give it a search
What do you have right now?
Removed the one called Open
You won't need Animator SetBool anymore. Haven't you add TeleportTo?
oh gimma a sec xD
So i gotta change the animator at the end with a teleportTo?
Remove the animator
Then connect Branch false to TeleportTo
You will also need position of where you're going to teleport to
like this xD ?
Connect TeleportTo only from branch false
So i have to delete everything els but that?
Is there a way to edit player speed and jump height upon entering a trigger and reverting it upon exiting?
Keep the SetLocking and what it connected to
Use node OnPlayerTriggerEnter and Exit
set locking so those who says or in generel have something to do with locking?
Here are the nodes relating to forces that act on Players. For nodes that deal with Player positions, see Player Positions GetWalkSpeed / SetWalkSpeed float, working range around 0-5The speed at which a Player can walk around your world. Set this below your Run Speed. GetRunSpeed / SetRunSpeed floa...
Keep this part but remove connection to the right side
Also remove OnDeserialization node
okay got that. and still have the branch π
like this?
done xD
Then add a new public variable to store Transform. Transform is a position, rotation and scale of a game object. So create an empty game object in your scene at destination you want to teleport to, then asssign to a variable, then you can get position and rotation of the transform to input into TeleportTo
well i do have a tp systems.
Can it lock? Or can you edit it to be able to lock?
it cant lock- wich is what im trying to make
Either edit the existing TP or look into it and see how it use TeleportTo node
my tp node xD
Same thing but you just need to prevent Interact from executing TeleportTo when it's locking
so i gotta set locking before interact?
SetLocking must only execute when you interact with locking button
so? xD
So set locking mustn't connect to teleport to
So how would u set it?
Insert branch with locking in between Interact and TeleportTo
Or did you ask how to set locking?
yeah how to locking
just need locking from 1 end. and then when ppl arrived at the room
I want to split my map in to 2 parts with a teleport were when somone goes through the teleport everything loads out (Including the avatars on the other side) how would I do that?
This
do i need to put it in front or?
Put it but not connect with anything else
You can't unload everything in a scene. You can still setup occlusion culling or reduce clipping plane to prevent thing from getting rendered
im confsued now xD
What do you have now?
Ye loading out the world itself and teleporting is not the porblem, it's how I unload players is that possible?
Not possible
havent done much becorse i got more and more confused xD
Occlusion culling and clipping plane sill apply to player. Occlusion culling isn't a way unloading the scene so that is misunderstanding.
okay what did i have to do to make it lock
You mean set locking state or prevent player from TP when it's locking?
yeah i want to set a lock on the tp so people can lock it so others cant teleport there
Yes I know but there's 2 interaction:
- Interaction with lock button to set locking state
- Interaction with the door to TP
which one you're going to do first?
i want a locking button
This one is for interaction to set locking state when the locking button is pressed
so i only have to keep the top part?
The flow should end at SetLocking so that I said you have to cut connection from the right side of SetLocking
The bottom part is for TP interaction and you keep it and don't connect to the top part
so i have to put them in to the same ?
I changed my mind. You should move locking state to the locking button itself
Along with moving top part of the graph into locking button graph
can u give me an example xD
Not right now sorry
so i need to put in a transform right?
Don't connect Setlocking to TeleportTo
Those are separated action.
That mean if you toggle locking then it will tp you
so what do i have to connect it to xD
What to what?
connect it to π
Keep this part and don't connect to anything outside of this image
okay done xD
That's an interaction when you toggle locking. And you don't wan't to TP when you interact with the lock button
no the Lock is just gonna lock it π
Therefore you don't connect the TeleportTo node to whatever it interaction with locking machanism
So i gonna insert the tp udon in the same like 2 sec xD
like this?
okay so infront of the tp script?
Front
this?
You have two tp node now remove the one to the left side
and insert the branch between interact node and tp
And try figuring out from what I've told you earlier
Can you repeat it xD
So i need two branch?
One branch
wich i have to connect to those two. and now the interact?,
I originally asked this in a different channel but figured it may be better to ask here
How can I set this up to only happen to a LOCAL player?
you need to check if the player that entered/exit is local and plug that into a branch
How do I do this though
@grand temple sorry for the ping but could you elaborate on how to do that?
plug the playerapi from onplayertriggerenter into a playerapi islocal node, and plug that into a branch node
then put the branch node between the onplayertriggerenter and the setrunspeed
@grand temple Got part of what you were saying but still got an issue
What would I plug into the instance?
Gotcha
anyone able to help me xD?
how do i update udon sharp? do i delete the folder then reimport the new one?
well, i havent updated udon sharp in a while since i havent touched it
lkdjaslkdnjmal
but im upgading my project to 2019
unity
i dont know how old my udon sharp is
If you udon sharp version is lower than 0.19.2 (there is a version file inside the udonSharp assets folder you can check)
If it is older that 0.19,2 then you need to delete Assets/UdonSharp/Plugins folder first. Otherwise just import the new package
thanks!
All right I think I wrapped my head around deserializationβ¦ I donβt need to update variables when receive deserializationβ¦. The values are updated magically on their own. I only need OnDeserialization if I actually need to update the world based on those values as they came in. Is this correct?
hmm...i tried migration methods, and my sdk gets broken in unity 2019?
my sdk from 2018 hasnt been updated in a while,
so i wonder if its related to that somehow
i have backups but
did you import the new SDK after migrating?
yes i followed the instructions, make a new scene
and import after
it still got broke
exactly what broke?
could you share a screenshot?
i can but its going to take me a bit, i actually made a backup and planned to try again and i already deleted the corrupted project so
if it happens twice i will do it
it might also help to do a clean install. Close unity, delete the vrcsdk and udon folders, then reopen unity and import the sdk
what udon folders in paritcular, udon shap?
sorry dumb question
oh you mean the Udon that vomes with the sdk
sorry i think i understnad
you could also delete udonsharp too to be safe
alright
does anyone have the latest 2018 Sdk
i wonder if its just ...breaking because like its old sdk and the updgrade is too much or something
screenshots?
@grand temple mind if I trouble you for one more thing?
don't ask to ask, just ask
Is there a way to track if specifically the player's view point entering a trigger collider?
sure, the simplest way would be to make a really tiny sphere and make it follow the player's head with an update loop
I just meant specifically in graph
I have a pool and I want it to spawn a sort of post processing cube only when the player's view is within the trigger
post process volumes already have the option of being enabled when the player's head is inside a collider
See the issue is
Post processing isn't on Quest
But I have a shader that over-renders everything else and is transparent black
Since it over renders everything, I only want it to spawn if the player's view is submerged
you could calculate it manually instead of making use of physics but it's more complicated
you would use transform.inversetransformpoint and then if it's a sphere collider, check if the magnitude is less than the radius of the sphere. If it's a box collider, you'd have to check if each axis is less than each of the bounds of the box
So how would I go about doing this with graph?
get the position of the player's head with playerapi.gettrackingdata.position, and then plug that into transform.inversetransform point
Okay I've got this
you also need networking.localplayer and playerapi.gettrackingdata
Alright so now it's like this
now you need the transform that has the region
plug that into the "instance" slot of inversetransformpoint
What does this mean? The bounds of the collider?
It is a box collider by the way
well since you're calculating it manually, it doesn't need to be a collider
but you just need it's transform
I think you might want to try the first method
@~@
Okay so what would that entail
I am such a noob at this
I have the transform of a Unity cube that can be used as the collider
@grand temple would this work?
ok then you need to get the scale of the box collider and check if each axis of the inversetransformpoint is within the bounds of the box collider
at the very least, make the center of the box zero so you don't have to account for that
The target object is the size of whatever collider I would need
This is the collider for the dark effect
So what do I do from there?
check if the result of inversetransformpoint is within the bounds of the collider
check if the x axis is less than 0.5 and greater than -0.5, check if the y axis is less than 0.5 and less than -0.5, and then check if the z axis is less than 0.5 and greater than -0.5
logic or conndition?
conditional
umm
you need to split the vector3 and get the individual parts
vector3 get x, vector3 get y, vector3 get z
So like this?
you have them flipped, it's (top value) less than (bottom value)
Got it
And now attach these to x and y?
@grand temple Got the ands in place, now what?
Like so?
yep
now use that for setting a gameobject active
and use update so it always checks
I haven't used update so how do I go about that
it's just an event that happens every frame
yeah but there's no reason to use a branch
just plug the bool directly into the setactive
no I don't
Alright, well figured I'd at least throw the offer out. You've been a tremendous help
does anyone know how to pull the current url being played out of the video player object?
So i made this simple little thing. It works, but it appears to be networked. The toggle toggles when anyone leaves the trigger. How do i make it local?
onplayertriggerexit happens when any player touches the object, but it gives you the player so all you need to do is check if that player is local. The "playerapi islocal" node is what you want, and then you plug that into a "branch" node. The branch node would go in between the onplayertriggerexit and the set "ison"
Like so?
you need to plug in the playerapi that you get from the onplayertriggerexit
Ahh yeah ofc. Well thanks! π
so ugh.. i opened the jam thing
:D
nice vrcworld
doenst seem like scene descriptor script exists
had to relaunch unity all good
Did you import the package into unity?
Hey silly question but I see these examples here in the doc but I'm not finding them in the sdk examples folder in my project:
https://docs.vrchat.com/docs/udon-example-scene
This scene is ready to Build & Test or Publish, and it demonstrates many common interactive items. Prefabs These objects show off some of the Prefabs included with the SDK which demonstrate default interactions with the VRChat components for Avatar Pedestals, Stations and Mirrors. AvatarPedestal...
Am I supposed to download this example scene elsewhere?
Oops, found it!
So what's the actual difference in video players between the Unity and AvPro players?
the AVPro players can play more formats like livestreams, etc.
Ahh I see.
Hey, so I'm trying to do some stuff on a non-player humanoid avatar - problem is, I can't for the life of me get my OnAnimatorIK() callback called from my U# script. And yes, I do have IK Pass checked in the animator. Any ideas?
I don't suppose there's a quick math node in Udon that can take two values and spit out the difference between them?
You need to know the larger number in advance for that though.
Anyone able to help trying to make a TP lock systems xD but im kinda new at this xD
Thereβs an absolute value node too
What behavior are you trying to implement specifically?
well a lock state for a TP button
Yeah, what's the intended use of it?
huh
What is this TP Lock state actually going to do in your world?
well its gonna lock a button - so people cant use the TP to go into that room
Well you need a Branch on Interact that checks what Locking is set to and only progresses to TeleportTo if it's false. There should be no link between SetLocking and TeleportTo, and you need to hook that Unary Negation up to the Locking value.
All ToggleLock needs to do is Set Locking via unary negation of Locking. We don't care what it's previous value is.
Is there a way to tell if something like a particle emitter is part of an avatar or an object in the game world?
like this?
Yup, just gotta connect Locking to that Branch and you're set. Its own node, not from the existing one tethered to the UnaryNegation.
wich locking π
The bool value?
So this?
Nooo.
Better
Now you need to connect Locking to the Branches as well.
Because right now they don't know what you want to check is true or false.
well thats true when is use the one i setup there in the pic. the lock button just tps me xD
Your branch is built wrong though. It needs a bool value to read.
a locking bool?
That Locking value IS a bool.
Drag another copy of that value into your graph, connect it to each Branch.
All you're doing right now is setting Locking, but you're not reading it anywhere.
this?
so with the other branch - or the first one i need to connect it to the value of that branch aswell
Just make another Locking value and connect that to the Branch.
THERE we go, finally.
sorry for my slow learning curve xD
Hey, we got you there in the end.
Thanks for the help bud π
seems like im still teleporting when i use the lock button xD
Remove the flow line going from the set locking node to the branch
Anyone got any ideas for my own problem? I'm looking to check if a ParticleEmitter is part of a player or an object in the world.
you mean this ? π€
Yes
What do you mean part of a player?
Do you just mean checking if the particle collision is coming from a player?
Yes
Udon doesn't really have a direct way to tell if a particle collision came from a player or not unlike SDK2 which could gate based on the layer of the particle
But an alternative you can do is have the particle system itself be the event sender
Assuming that is what you want to do
I think you just solved the problem for me; I'll just try putting them on their own specific layer.
sheeesh now i need to solve mine O.O
well seems like when i try to use the lock for my tp its just tp's me instead of locking
Do you have a separate object interact that sends a custom event to that one that you showed?
this is what i got
Oh wait in your graph you are going custom event through a branch
remove the branch and connect the event straight to the set locking
like this
Yeah
Though whats your other udon behavior like?
You should have another one that sends the custom event right?
what do you mean ?
What are you trying to do? have a button that locks it or have it lock when someone teleports?
im want a button that locks the tp. wich you come from. so people cant use the same to go where it leads
So you want it to lock for other players after someone uses that teleport?
yes
You would want something like this then
so like this?
Does an UdonGraph with an OnPickupUseDown Event have to be on the same gameobject as the Pickup component, or will it work if it's a child of it? (Eg, if I have a pickup object with several gameobjects inside it, will those react to the player attempting to Use the held object?)
Yes but you would want to keep the position, rotation and local player references for your teleport
Pretty sure it will only fire if its on the same game object as the pickup
Thought as much, but worth a check to save an extra graph if I could.
this?
On the set locking node you need to make a constant bool and have it as true
constant bool?
Search for bool nodes and then in the bool nodes pick constant
like this?
i think it is O.o
What is it plugged into in your screenshot?
well to the locking bool - but when i try to set it into the set lock - i just goes there
Remove the other one first
?
deleted it - does not seem like i have any errors
Oh well that should work then
though now you would need logic to unlock the teleport too
i got the keypad fab
well the button still tp's me
well okay so i a few buttons - a keypad where you have to put in a code. wich then show a button they can use for teleporrting - to a room - in that room i have tp to teleport you back. and one i wanna use as a lock wich is then gonna lock the button they used to get there. so they cant teleport there
You need to set the bool constant to true
just by pressing the box right?
Yes
Are there any improvements planned for the assembler? For example, operations on direct access to variables or jumps, copying variables to an address. Something like this:
PUSH, behaviour
JUMP_INSTANCE, 0x00000000
PUSH, behaviour
PUSH, jumpAddress
JUMP_INSTANCE_INDIRECT
PUSH, behaviour
PUSH, variableAddress
COPY_TO_INSTANCE, inVariable
PUSH, behaviour
PUSH, variableAddress
COPY_FROM_INSTANCE, outVariable
PUSH, toAddress
COPY_TO_ADDRESS, fromVariable
PUSH, fromAddress
COPY_FROM_ADDRESS, toVariable
PUSH, fromAddress
PUSH, toAddress
COPY_FROM_TO_ADDRESS
what does this do on the set varyable block
so did it - it still teleports me and not locking - -
Screenshot of the graph?
And you pressed the compile button?
yeah
Asking again since the first time was at a really odd time: I'm trying to control a non-player humanoid avatar - problem is, I can't for the life of me get my OnAnimatorIK() callback called from my U# script. And yes, I do have IK Pass checked in the animator. Any ideas?
available today xD ?
Not quite. I have only around 10 minutes
ohh cool
Do you still have another udon on locking button?
well got the other one you helped me with. when it came to animator locked door
The locking button shouldn't have that animator
this one is the lock for the other doors
You should create a new variable here called "locking"
We're going to move the locking state into the lock itself
so just like we did once before just in this one instead?
Yes. With GetLocking then unarynegate then setlocking
okay im on it
Also custom event from the door udon
okay got the Unary and set lock. get lock was what?
The one that you replaced with const bool
oh
so like this?
done
What do you have now, the graph?
Connect the top 4 to each other, hope you remember how
kinda remeber xD
good. The custom event is the same name as the sting below
yeah done
Back to the door
FYI if you wire up the target UdonBehaviour to that Door variable, then you can choose the eventName from a dropdown instead of using a string const. Will ensure you spell it the same in both places, and show an error if you ever rename the "ToggleLock" event so you know why it's no longer working.
Add a new UdonBehavior variable to the door udon, better call it lockButton
do i wanna make i public
yes that too
but didnt i have to remove the door?
A is to replace by SetProgramVariable
B is GetLockButton and connect to A instance slot
Also remove the top group of three
like this?
I'm building a world and I want to prevent opening user portals within a, say, 40m x 10m area but allow them outside there. The most stupid implementation should be placing lots of (dummy) spawn points all over the target area, though I wonder if some "smarter" method exists, does it?
we don't have a way to mark a specific area as non-portal-able other than spawn points afaik
Oh... the 400 spawn points would make it up for a while, thank you
do you specifically need that area to prevent portals? Or do you need the whole world to prevent portals? "forbid user portals" is an option in the scene descriptor if you want the entire world affected
Hey what's the difference between an udon script getting another object's udon component & firing off a method vs. sending a custom event? Is the first method something that's only experienced for the local player?
that's the same thing
if you wanted to fire a method on another udonbehaviour, you would do so by sending a custom event
if you wanted it networked, you would do so with "SendCustomNetworkEvent"
Ahh, so I guess my question is what should be sent over the network? Like let's say one object's behavior pulls various other objects around the scene close to it- is the only way to get all players to see this effect of "pulling things in" to send a custom network event? Or is position something that is automatically persisted over the network
position is only synced if you want it to be. You would do that by adding the objectsync component. Then when a player wants to move an object that is synced, they would need to take ownership of it before moving it
however that is only necessary if the movement is dynamic. If it's just moving from fixed point A to fixed point B, a network event would suffice because that is all the information that is necessary
I thought ownership transfer was automatic
if it has a pickup, then yes you will take ownership automatically when you pick it up
but if a script is just setting the position, then the script needs to take ownership
Yeah that's what my behavior is doing, I'm still very green with working with the sdk so I'm stumbling a bit, but I'm coming up with a way for a player to hold multiple objects at once, so to speak
then yeah, your best bet is to take ownership and set position
Somehow I keep ending up with infinite network event loops on deserialization
what are you doing in ondeserialization?
Updating all of my variables
are you modifying the synced variables?
or modifying local variables by using synced variables?
All right I think Iβm starting to immediately detect that I donβt know what Iβm doing
β¦ ok thatβs what synced does. Disregard I know what Iβm doing wrong
I made everything way more complicated than I needed to
I need a portal prohibited area AND a portal allowed area, so VRCWorld setting is not enough for me. thank you
anyone know how to lerp or slow parent an object with udon?
I'm trying to make a custom pickup float towards the player in desktop mode on interact. For now it's not supposed to be picked up or do anything, just fly towards them.
Once interacted I'm making it's ridig body kinematic and collider disabled. Then I'm using Transform.Lerp to move the object towards the player's head and once it reaches it it should (for now) just fall back to the ground.
For some reason it still lingers in the air for a while. I thought lerp is supposed to reach 1 (the time when it should drop to the ground) when it's at the destination not reach it, stop for a while then drop.
I also noticed that the further away I'm from 0,0,0 the more the offset between the player and the gun is. What am I doing wrong?
float lerpTimeToPickup = 0.8f;
float _lerpTime = 0;
bool MoveTowardsPlayer
{
get => _moveTowardsPlayer;
set
{
_moveTowardsPlayer = value;
rigi.isKinematic = value;
col.enabled = !value;
_lerpTime = 0;
}
}
void FixedUpdate()
{
if(!MoveTowardsPlayer)
return;
Vector3 playerPos = player.GetPosition();
VRCPlayerApi.TrackingData localData = player.GetTrackingData(VRCPlayerApi.TrackingDataType.Head);
_lerpTime += Time.fixedDeltaTime * lerpSpeedMultiplier;
Vector3 newPos = Vector3.Lerp(transform.position, playerPos + localData.position, _lerpTime);
Quaternion newRot = Quaternion.Lerp(transform.rotation, localData.rotation, _lerpTime);
transform.SetPositionAndRotation(newPos, newRot);
Debug.Log("Lerp time is: " + _lerpTime);
if(_lerpTime >= lerpTimeToPickup)
MoveTowardsPlayer = false;
}
public override void Interact()
{
MoveTowardsPlayer = true;
}
For reference this is what I'm going for (minus sticking to the camera for now)
Pumkin ninja
So I'm trying to control a non-player humanoid avatar - problem is, I can't for the life of me get my OnAnimatorIK() callback called from my U# script. And yes, I do have IK Pass checked in the animator. Any ideas? Does that callback just not work in Udon?
So I've got a problem where when the owner of a script leaves, OnPlayerLeft gives me a null VRCPlayerApi. Has anyone got any tips for how to get around this? I'm considering using something like OnOwnershipRequest or OnOwnershipTransferred to cover the owner leaving, but that feels clunky
once the player has left, it's too late to do much other than some cleanup. What is it that you want to do when a player leaves?
if you put a script like this on the same object as the UdonBehaviour, does it log?
using UnityEngine;
public class CheckAnimatorIK : MonoBehaviour
{
private void OnAnimatorIK(int layerIndex)
{
Debug.Log($"Heard OnAnimatorIK at {Time.time}");
}
}
So you're saying double check that it should fire using a MonoBehaviour? Ok, I'll test this out
Exactly. I've never used OnAnimatorIK but it's technically supported. If it fires on a MonoBehaviour but not on an UdonBehaviour, then you've found a bug.
I'm trying to return an object to an object pool
Ah, ok. FWIW - we just released a project where we do exactly this:
https://github.com/vrchat/VRChat-Obstacle-Jam
https://docs.vrchat.com/docs/uoc-how-stuff-works#playerdatamanager
When a player joins, we assign them an object from the pool (this program is on the PlayerDataManager, which has a reference to the pool)
then when that object's ownership changes, we check if the object has not been initialized by looking at a synced int called playerId which has a default of -1. If it's -1, we set it to the new owner's id
(the rest of the logic is all on the PlayerData objects from the pool)
However - if Ownership changes and the playerId is not set to -1, then we can assume that this player has left, and we can have the owner of the ObjectPool set the playerId back to -1 and return the object
Ooh that's pretty much exactly what I needed, thanks a bunch!
sure thing! I think it's a pretty solid pattern.
you could simplify things a little by having the playerdata objects have a reference to the pool directly instead of fetching it through another object (the PlayerDataManager, in this case)
then you can just check if the local player is the owner of the gameObject that the pool is on, and return it if they are.
@floral dove Ok, I ran that experiment. The MonoBehaviour's event does log. The U# callback still doesn't. And to be clear, I was using U#, so I'll go verify with a graph program as well.
@floral dove Yep, silence from the Graph program as well. Posting both programs below.
using UdonSharp;
using UnityEngine;
using VRC.SDKBase;
using VRC.Udon;
[RequireComponent(typeof(Animator))]
public class AvatarDriverTest : UdonSharpBehaviour
{
public GameObject target;
public Animator animator;
private void Start()
{
animator = gameObject.GetComponent<Animator>();
}
public void OnAnimatorIK(int layerIndex)
{
Debug.Log("U# OnIK");
animator.SetIKPosition(AvatarIKGoal.LeftHand, target.transform.position);
animator.SetIKRotation(AvatarIKGoal.LeftHand, target.transform.rotation);
animator.SetIKPositionWeight(AvatarIKGoal.LeftHand, 0.5f);
animator.SetIKRotationWeight(AvatarIKGoal.LeftHand, 0.5f);
}
}```
Aha! I'm sorry to hear that but thankful that you've found this issue. We recently moved some events to proxies, that could be part of the issue. If you file a Canny, then we'll update you when it's fixed.
Well that's fun, it's been a while since I've seen a one-character bug like that lol
@fiery yoke has there been any new changes in your seamless portal system? If it's gotten better, I'm curious if you would allow me to copy it into my own world. If not, could you elaborate more on these "weird tricks" you used?
Portals that work with Avatars ^^
Not perfect. But close enoughπ
#VRChat #madewithudon https://t.co/oa2qJwTfDb
I'm especially curious about the stencil / rendering tricks, but we can talk in #shaders for that
Despite fixing whole script issue with import of UrlInputField, it still seems not to receive any active focus nor input from the keyboard, while the rest of the UI around works perfectly fine. Is it still related to swap of unity versions?
What's the best way to calculate if an object is upright? I get the feeling Vector3.up is involved, but not quite sure of the best way to parse that against the object's rotation.
is this how i make it so that a player trigger only effects the local player
aka noone else trips it on your client but you
Hi, does anyone here know much about the AV Pro in the SDK? Im trying to stream twitch and most accounts work but not mine. Could it be due to a bad internet connection of mine? All I get is a blank plane where the stream should be.
I figured out what I was doing wrong to some extent. I assumed tracking PlayerTrackingData held values in local space, but they're global. Annoyingly, I don't think the docs mention this
Can I spawn an object to player's avatar and follow him around?
anyone got a clue about this?
Still fighting with a lock system for teleport
Haiai, This might be silly question but I want to make like a brush that plays different audios when you click trigger (Click 1 plays audio 1, Next click plays audio 2) etc..
How do I do this? If it requires code maybe U# possible?
what causes every time I enter a room that will trigger an irrelevant event.
Use an array of sound clips and play the one you want
You can use AudioSource.PlayOneShot which spawns an audio source, plays a sound and destroys it. I think you're better off having one audio source and replace the sound clip in it before playing
Hmm But how do I actually use click to trigger something on an object?
Do you place a button on the object you hold in hand?
onUse? also, PlayOneShot is good for optimization just note that it will be a local only sound.
Your brush should have a VRCPickup component on it, which has a onUse yeah
I feel so silly, I just don't understand, I try to google on OnUse to see if I can find any documentation / guides on how to use this but couldn't find anything,
Then I realised I had @cunning mist's (Sorry for tag!!) vacuum, It has so if you pick it up and click trigger, it disabled the volume, So I thought I could see in U# how he did it ( https://vowgan.booth.pm/items/3085036 )
However when looking at the U# I don't see anything that uses onuse or what exactly disables the audio, It just "works"
You need to have the pickup be Auto-Hold = True, then you use the event "OnPickupUseDown"
i made a usharp brush 8 days ago i could send you later if you want it
the UdonExampleScene that comes bundled with the SDK has lots of helpful examples - there's this one about using Interact: https://docs.vrchat.com/docs/udon-example-scene#interactcube and this one if you want an item that you can pick up and then use: https://docs.vrchat.com/docs/udon-example-scene#pickupcube
I'd love to!
Wow! Thatβs exactly what Iβve wanted for a while
I love non-euclidian spaces, but the prefabs for making them were always a trade secret
It's because it deals with this
Hope there is a public prefab for us plebs one day so vrchat in general can get less Euclidian
There is a few components to it, but yeah essentially its a lot of rendering jank and matrix math. I took most of the maths from Sebastian Lagues video about portals, some of the stuff is directly from the Portal developers talk on how portal works technically and some stuff I just..."invented" because of how VRChat does rendering stuff.
I'm not too familiar with VRchat rendering quirks, got any more juicy info on that?
Honestly Im not either. Im not really a rendering person. I dont even really know what the shaders do that I wrote there anymore.
Something with Z-Buffer Manipulation lol.
And how did you deal with the VR stereoscopic stuff?
I didnt. I render everything to the screen lol
And what about the cloning / teleportation?
I render everything in a specific order, with different cameras that have different culling masks, and certain stuff is on special layers that are only rendered by some caremas, with special shaders that manipulate the Z-Buffer. Its pretty complex.
Could you provide the Z-buffer shader code, or links to resources that helped you with it?
Well I dont really want to dig up my old stuff and try to reason about it right now, because Im working on something else at the moment.
But here is a good general video about portals:
https://www.youtube.com/watch?v=cWpFZbjtSQg
Experimenting with portals, for science.
The project is available here: https://github.com/SebLague/Portals/tree/master
If you'd like to get early access to new projects, or simply want to support me in creating more videos, please visit https://www.patreon.com/SebastianLague
Resources I used:
http://tomhulton.blogspot.com/2015/08/portal-rende...
Yeah, I watched it earlier and copied it into a separate unity project (non Vrchat). Still trying to understand it, especially with the PortalTraveller list
Well for VRChat you cant do cloning, so I just render the avatars from the other view onto the screen.
Is any of this stuff available for download or purchase? Iβve been wanting to do weird topology stuff for a while
VRChat is kinda "anti" when it come to this, because its unpredictable behaviour where you might end up getting softlocked.
I guess I donβt follow
If you are not careful with your cameras, you could end up with very nauseating effects, and because you dont see your menu you cant escape from the world without closing VRChat. Which from VRChats perspective is "not favorable" to the point where none of this is really supported. Its possible. But you are not "supposed" to do it. Plus messing with rendering is very limited, since you have to basically "replace" the actual player camera with your own to precisely control the order.
Hey. Is it possible to make a connection from C# / udon? Or is there any mechanism for a vr chat avatar / client to receive input from another program?
Ideally I'd make a websocket or similar connection to another program on my desktop and when the vrchat client receives a message, the bones rotate. Simple example
So, no traffic through vr chat servers, just a connection I could proxy to create a remotely controlled avatar or something
The only routes currently possible for communication within Udon are via Logs or Midi. Midi can only currently get data into Udon. We have some plans for bidirectional communication via OSC but no release date yet.
ah, glad to hear it's planned at least. I just think some dynamic bone control would be more interesting than a bunch of presets. More avatar quirks with less data!
is some really rough communication possible with logs and midi? like logs to read data from the client and midi to upload data to the client?
Ah, found the midi docs. That would be a really interesting way to do what I'm trying to, hah. What are logs? Is that just where Debug.Log ends up from vrc?
yes, it's in appdata/locallow/vrchat
avatars can also send debug logs with state behaviours
Hah, that sounds like an amazing workaround. But if I defeated PEGA, I can do this!
That's not breaking any rules, is it? Using midi input to remotely control an avatar?
I'm not aware of any way to control avatars with midi, just worlds
Oh, darn. I've seen a few worlds with npc avatars walking around, wasn't sure if that was world code moving them or avatar code π¦
oh, that's 100% world code
avatar code is very explicitly different and only applies to actual players
if you want to use udon to control npcs, you absolutely can
also another way of getting data into vrchat is to use an inputfield. That may be simpler than MIDI, though it will require the window to be focused
my hope was a player avatar that could be controlled by some external input, I suppose that's not possible?
that depends what you really want. Like if you want it to actually have all the properties of a real player then your best bet is to literally just run another client and give it controls as if it was a real player
but if you just want a character to walk around, talk to people, do things, then there's no reason you can't just build that with udon
an npc that could world hop would be cool too, that's the main "player" feature I am after
running a vr chat client and emulating controls to it would also be fine with me! I just assumed that would be treated as botting and that's usually bannable so I asked for an internal / integrated solution π
as long as you don't modify the client itself I think that's fine
last question then would be - can desktop avatars have limbs follow fake "trackers" or would I have to emulate a VR system to, for example, have an avatar wave at someone with Ik?
You could approach that in two ways. First is to simply make an avatar with those features in the action menu. Literally just animation that play out. The second is to write your own steamvr driver that makes it think there's a headset and controllers and tell it from code exactly where everything is
without some mechanism to target and move arbitrary bones in the model, I suspect moving a handful of bones following fake trackers might be the better solution for me
thanks
writing a steamvr driver is far from simple, but if you think you're up for it then I won't stop you lol
Yea... first I'll see what I can do inside unity with a desktop model, a bone, and a text input like you mentioned before
see what C# can and can't do
steamvr driver would probably be 100% c++
I'm unfamiliar with a lot of that unfortunately. Been programming since the early 2000s but never made a driver
me neither, but I've peeked at some stuff like openvr advanced settings and it looks complicated https://github.com/OpenVR-Advanced-Settings/OpenVR-AdvancedSettings
I thought it might be as easy as launching an emulated controller / tracker and controlling it with a nice simple json api π¦
I didn't realize how locked down the programming part of vrchat might be. Might not be able to make an avatar with ik limbs controlled by another server in the house π¦
without that part of the avatar/client api, it seems like even that OSC messaging update won't help that
The OSC approach includes a new API for controlling avatar parameters and eventually limbs (via tracker movement, most likely)
is there a roadmap or timeline for that?
it would be awesome if I could position arbitrary bones to have 3+ armed models, but being able to emulate a full body player is a great start!
if it's ~1 year out, I could wait for that instead of trying to engineer a steamvr driver... although based on my googling, people would really appreciate one lol
It wasnβt on the road map of the features coming out this year so my ballpark would be βnot this yearβ
First thing Iβm doing on it is making true eyetracking so I canβt wait
I'm deciding between emulated index controller or building a steamvr driver that can / build a map so I can control a thing as an npc / doing nothing and hoping vr chat is still popular when that feature comes out
doing nothing is always a tempting option when a future update might make any work you do before it pointless
I see an update from 4 months ago about OSC. I guess learning how that works could be a good use of time
Itβs more of a general data protocol. How you use it will largely depend on VRChatβs implementation of it
ah. so that probably just needs an afternoon to glance at
ty for the help everyone, I'll lurk & keep an eye out.
It sounds like you want a regular Interact script rather than a pickup
I believe pickups can only be used while being held
You could have two different hotspots, one to interact with it, and another to pick it up
There is some property of the game object that controls how far away it can be held. This is different from proximity which is how far away it can be grabbed. If the grab distance is larger than the maximum held distance, it will teleport closer.
If they are outside the proximity distance, they canβt grab it at all
Iβll have to experiment to see how the grabbable volume is calculated. It might just be the collider.
ay so im trying to figure out how to make a combat system with udon but i dont exactly know how to trying to do a gun pvp world anyhelp would be great
is there any way I can check some logic every 1ms? on Update rely on frame, I want something like Thread.Sleep?
Why do you need that much precision?
actually I don't need that much but I didn't want the precision rely on frame. I can just use fixed update though..
FixedUpdate could work, or just not work. It's better to use event based triggering to record start and stop time instead of doing counting on every frame.
trying to make a lock system for Teleporter - so faar its's not working anyone able to help?
I'm encountering a really strange issue in U# with System.Convert.FromBase64String.
The issue is that if I pass it any sort of variable, it will cause an exception, stating "The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or an illegal character among the padding characters."
However, if I call the function and put a Base64 string in directly, the method behaves as expected.
Here, the first line executes no problem, while the second line causes an exception. I've made absolutely certain that the resulting string object from new string(finishedCharArray) is identical to the string I put in the first line.
Ohh this is very unconventional in a Udon sense. Udon does not dynamically allocate variables. It needs to know of all variables existing at compile time.
So try putting your string constructor in a seperate variable before calling the method.
Like this? I've separated out every method return value into its own variable, defined at the start of the file right after the class. I'm then setting these one-by-one in my own method.
Still throws an exception when I call FromBase64String.
Not sure what to make of it. If I add in:
Debug.Log(new string(finishedCharArray));
Then the string will be printed to the console without issue as we haven't tried to decode it yet. If I then copy the whole string exactly as it appears from the Unity console and compare it like this:
stringEncoded = new string(finishedCharArray);
Debug.Log("dGhpcyBpcyBhIHRlc3Qgc3RyaW5n".Equals(stringEncoded));
...then I get False back. So they're not the same string? But if I print stringEncoded before I do the comparison, then it's... the same string.
Let me see if I can replicate this issue in a new, smaller script just for testing this.
able to help me hopefully finish it today?
What is situation now?
For some reason i cant connect Get PrivateTP to the getprogramvariable
Show screenshot
Alright, I just realised it's 8 in the morning and I haven't slept yet, so I'm gonna go... do that. Here's where I'm at:
using UdonSharp;
using UnityEngine;
using VRC.SDKBase;
using VRC.Udon;
public class Base64DecodeTest : UdonSharpBehaviour
{
char[] finishedCharArray = new char[] {'d','G','h','p','c','y','B','p','c','y','B','h','I','H','R','l','c','3','Q','g','c','3','R','y','a','W','5','n'};
string stringEncoded;
byte[] rawDecoded;
void Start()
{
// create a string object from the char array and set stringEncoded to it.
stringEncoded = new string(finishedCharArray);
// this should print "dGhpcyBpcyBhIHRlc3Qgc3RyaW5n" without issue
Debug.Log(stringEncoded);
// this should decode the string and put the return value in the rawDecoded array
rawDecoded = System.Convert.FromBase64String(stringEncoded);
}
}
This runs without issue, the base64 gets decoded, and the byte array gets filled with the correct data. So I'm still not 100% sure where the issue in my other script is. Maybe some sort of bug to do with constructing the char array at runtime instead of having it be a constant? The only other difference I can think of between these is that here it runs in a Start() whereas in my other script, the code runs from the MidiControlChange() event. Going to take another crack at this tomorrow and I'll be back in here if I can't get it to behave. I appreciate the help!
?
Drag the variable into the graph and connect line to instance slot
Like this right? - That is what it wont allow me
PrivateTP should be UdonBehavior type, not gameobject
You create the variable with wrong type
so you want me to make a udon - like this?
Yes. Does symbol name the same name as locking variable in lock button udon?
dammit i have to make for the button aswell -.- thought this was it dammit xD - wait i could reuse the same as for the door right?
Only for doors. Lock button should have a different one
Hi, Is it possible to make it so when a player spawns in to the world he hears the world music and then walks trough a triggercollider and the music is turned off but only for him, when a another player comes in, that player will hear the music too but the first player should not hear it, so actually the music should be local and stays local.
Yes thats possible :>
I have only the udon script for global
Which component should I use for making it lokal?
Instead of using OnPlayerJoined, just use Start.
Ok, thats all?
Should be.
Ok, will try that, ty
When you join an instance with people already in it OnPlayerJoined fires for all users already in the instance including yourself
anyone know how to set up Qv pens on a udon world
Any tutorial how to make resync button for video players ?
Unless you want to get into the nitty gritty of networking I wouldnt suggest making your own video player. Unless ofcourse you just want to learn something new.
If you just want a working video player to use and dont want to make your own, then I would recommend looking for one someone has already made.
Im currently still working on mine unfortunately π
Well it is always good to learn something new.
Of course. But in this case its relatively complex so there is no "This is exactly how you do this" tutorial. What I mean with that is that people who make this simply know the behaviour of Synced Variables, Networked Events and Video Players themselves. And then use the behaviour of these individual components to create something like a syncable video player. So the in my opinion best way to learn how to make something like that is first learning how the individual components work. And unfortunately I dont really think there is in depth tutorials about those either. Just written documentation and personal experience by trial-and-error
how can i make a custom event? when i try to make a custom event in the ''send custom network event'' i need to pick a custom event.. i dont know how to make the custom even tho.. and most of the tutorials on youtube are old and i just see people can type in anything..
Just add a custom event node from the node search menu. Once you give it a name and make it do something, hit compile and it will show up in the dropdown
Hello, when the event OnPlayerLeft is called, how do i get the playerId of the player who left ?
Hm, it may be too late to query anything about that player, but you could try just doing playerapi.playerid. if that causes your script to crash then onplayerleft is too late
it is too late, is there any other option ?
I guess you could keep an array of all the players and then an array of all their IDs. You can still do a comparison after they have left so you could do a for loop and find which one belongs to that player, then go over to the other array of IDs and pull out the corresponding entry
that gonna be heavy for nothing tho... but i guess that the only solution
I would however question why you need this? I might be able to offer a better solution if you shared what the purpose is
It allow me to refresh an UI that keep track of all the connected players
Oh well then you're probably going to do a lot of for loops anyway to do stuff like inserting a player into an empty slot or whatever
Actually yes... so i guess that doesn't change much
Is there a way to know the max number of player that can join a world ?
Not through udon. But you could just put a number somewhere that udon can read
The hard cap is (soft cap) * 2 + 2
That's the number you specify when uploading the world
Ok thank you
I mean through Udon, but i guess i'll just do a public var, thanks anyway.
hey im having trouble with vrchat it keeps disconnecting
Anyone have any documentation or prefabs etc of the audio boost area for vrc, like where you stand in it and it makes you louder for other players?
Alter the mic pickup script in this prefab to be an onplayertriggerenter instead of a pickup/drop and you are good to go. https://github.com/Guribo/BetterAudio/releases
thanks a lot
do you know if this is still useable in 2018?
guess i can use an older version
just inspect the releases and download the one before the 2019 update yeah. But you really shoudlnt be using 2018.
sweet ty
Hey I would like to have a cube that you can pick up and when it enters a trigger it should turn off gravity.
My issue is... How do I get the rigidbody component from a gameobject?
I don't quite understand the GetComponent thing yet.
I don't want to add a rigidbody variable because if I clone that cube it will still use the rigidbody from the original cube.
(I'm using Udon Graphs btw)
No, when you duplicate an object with a component it reads its own component. As for a graph, I cant help you with that. Script only.
Either use GetComponent on Start to cache the Rigidbody in a local variable, or use a public variable to set it at edit-time. Here's how GetComponent works: https://docs.unity3d.com/ScriptReference/GameObject.GetComponent.html
Hmm well thanks. I'll take a look at that
Okay I figured it out, but it doesn't seem to apply it when I set use Gravity to false via udon graphs.
Do I have to do something special with networking or why does that happen?
Are you sure this logic is running? You can add a call to Debug Log to see if it is, and to make sure that the component you're retrieving exists.
BTW - no need for a 'self' variable. You any 'instance' input that needs a GameObject, Transform or UdonBehaviour will default to self.



