1. Welcome to VRCat! Please note that this message board is not related to VRChat in any official manner. It is run entirely by the community, and moderated by the community. Any content present has not been reviewed by VRChat moderators or staff. Your use of these forums implies understanding of this message. Thanks!
    Dismiss Notice

Worlds basic button

Discussion in 'Tutorials and Tools' started by dog8808, Jan 13, 2018.

  1. dog8808

    dog8808 New Member

    Joined:
    Nov 28, 2017
    Messages:
    8
    Likes Received:
    20
    VRChat:
    jetdog8808
    This is how to create a basic button inside vrchat.
    prefab:https://vrcat.club/threads/simple-button-prefab.489/

    1.you will need a 3d object that the player can see. this can be a cube or a custom model. for this example, I made my own button.
    [​IMG]
    2.now you need to add a collider component this is how the player will be interacting with the button. unity has a few colliders that you can use but to keep it basic I will be using a box collider.
    [​IMG]
    3.the magic that lets players actually use the button is in the VRC_Trigger script. the trigger that will be used for the button will be the OnIntereact trigger (https://docs.vrchat.com/docs/oninteract). if you want the actions to be local you can change the broadcast types to local or keep it as AlwaysBufferOne where the action will happen for everyone (https://docs.vrchat.com/docs/trigger-broadcast-types).
    [​IMG]
    4.congratulations a basic button is made the next step would be to select an action you want your button to do. https://docs.vrchat.com/docs/trigger-actions

    More documentation can be found at: https://docs.vrchat.com/docs
     
    Mr.Crane and desunesu like this.
  2. Endymion

    Endymion Member

    Joined:
    Jan 10, 2018
    Messages:
    58
    Likes Received:
    37
    VRChat:
    Endymion
    Hello. Just wanted to ask. Is it possible to "push" the button down in VR, instead of clicking?

    I'm trying to make a button that goes down when you place your hand on it, then springs back into position when you remove your hand. However, it seems that the hands always pass through objects even if I add a collider and rigidbody on the object. The problem might lie with the user's hands. I can't find a way to access the collider attached to the hands.
     
  3. dog8808

    dog8808 New Member

    Joined:
    Nov 28, 2017
    Messages:
    8
    Likes Received:
    20
    VRChat:
    jetdog8808
    The user doesn't have a collider on their hands that can push objects. instead, you could create an animation that plays when you click the button. the animation would make the button go down as if it was being pushed down.

    one thing I have seen done is putting a collider on an avatar like the point of a finger that can interact with objects. but only people who have a collider like that on their avatar would be able to press the button.
     
    desunesu likes this.
  4. Endymion

    Endymion Member

    Joined:
    Jan 10, 2018
    Messages:
    58
    Likes Received:
    37
    VRChat:
    Endymion
    Ok thanks. It's clear to me now that I need to create a custom avatar just for pressing the button.
     
  5. FlameG102

    FlameG102 Member

    Joined:
    Jan 4, 2018
    Messages:
    25
    Likes Received:
    4
    Question! I have a button on my world already, that much i already figured out- I even tied it to what I want to tie it to- But my question is this:

    Is it possible to script it so that only the world owner can use the button? I have a video player in my world, and I'm looking to add some control buttons, but i want to be the only one who can access them.

    Is that doable?
     
  6. Mr.Crane

    Mr.Crane Member

    Joined:
    Nov 18, 2017
    Messages:
    167
    Likes Received:
    58
    Tick "advanced" in the trigger and set it to "Master" so only the creator of the instance can use it.
    Or use the master buffer one mode if you need it buffered. Owner is a bit misleading. It means the "owner" of the object.
    E.g. nobody can enable a pen to draw if not holding it at the same time (and take the 'ownership' of the object first by grabbing it).
     
  7. FlameG102

    FlameG102 Member

    Joined:
    Jan 4, 2018
    Messages:
    25
    Likes Received:
    4
    Huh. That seems simpler than I was expecting. Thanks

    What does Master buffer one mode do? Buffer the video beforehand?

    while we're on this subject- just for good measure- can i assume the video player is synchronized? is there any specific way to accomplish that? synchronize it for all people in the current instance?
     
  8. Mr.Crane

    Mr.Crane Member

    Joined:
    Nov 18, 2017
    Messages:
    167
    Likes Received:
    58
    FlameG102 likes this.
  9. FlameG102

    FlameG102 Member

    Joined:
    Jan 4, 2018
    Messages:
    25
    Likes Received:
    4
    lol, I learned what the buffer mode does the moment I actually looked at it. Thats what i get for asking questions at work where I don't have my project in front of me to play with.

    That said, that link is very helpful. Thanks
     
  10. Mr.Crane

    Mr.Crane Member

    Joined:
    Nov 18, 2017
    Messages:
    167
    Likes Received:
    58
    Just one more thing. If you use the skip forward and backward feature of the video panel you may have a short lag for all players in your map whenever someone changes the video. I suggest the master setting for that.

    And that link should be next to the SDK download button on the homepage!!!
     
  11. aaronfranke

    aaronfranke New Member

    Joined:
    Nov 18, 2019
    Messages:
    2
    Likes Received:
    0
    VRChat:
    aaronfranke
    Is there a way to make a button change the transform (set the position/rotation/scale) of an object?