Not a member of Pastebin yet?
                        Sign Up,
                        it unlocks many cool features!                    
                - using UdonSharp;
 - using UnityEngine;
 - using VRC.SDKBase;
 - using VRC.Udon;
 - using VRC.Udon.Common.Interfaces;
 - public class VRC_button_A_matt1 : UdonSharpBehaviour
 - {
 - public Transform Target;
 - [UdonSynced] bool IsOpen;
 - Vector3 OpenPosition = new Vector3(-0.207f, -1.63f, -0.56f);
 - Vector3 ClosePosition = new Vector3(-0.207f, 1.197f, -0.56f);
 - void Start()
 - {
 - Debug.Log("started VRC_button_A_matt1");
 - //DELETED target.localPosition = closePosition;
 - //GET ACTUAL POSITION OF THE DOOR WHICH IS NOW SYNCED
 - IsOpen = Target.localPosition == OpenPosition;
 - }
 - public override void Interact()
 - {
 - Debug.Log("Interacted");
 - SendCustomNetworkEvent(NetworkEventTarget.All, "NetworkEventStuff");
 - }
 - public void NetworkEventStuff()
 - {
 - if (IsOpen)
 - {
 - Target.localPosition = ClosePosition;
 - IsOpen = false;
 - }
 - else
 - {
 - Target.localPosition = OpenPosition;
 - IsOpen = true;
 - }
 - Debug.Log("changing position to " + Target.localPosition);
 - }
 - }
 
Advertisement
 
                    Add Comment                
                
                        Please, Sign In to add comment