Example #1
0
 void OnEnable()
 {
     if (sync == null)
     {
         sync = (VRC.SDK3.Components.VRCObjectSync)target;
     }
 }
 public override void OnInspectorGUI()
 {
     VRC.SDK3.Components.VRCObjectSync c = ((VRC.SDK3.Components.VRCObjectSync)target);
     if ((c.gameObject.GetComponent <Animator>() != null || c.gameObject.GetComponent <Animation>() != null) && c.SynchronizePhysics)
     {
         EditorGUILayout.HelpBox("If the Animator or Animation moves the root position of this object then it will conflict with physics synchronization.", MessageType.Warning);
     }
     DrawDefaultInspector();
 }
        public static void InitializeObjectSync(VRC_ObjectSync sync)
        {
            var helper = sync.GetComponent <CyanEmuObjectSyncHelper>();

            if (helper)
            {
                DestroyImmediate(helper);
            }

            sync.gameObject.AddComponent <CyanEmuObjectSyncHelper>();
        }
Example #4
0
    private void Start()
    {
        Assert(EngineControl != null, "Start: EngineControl != null");
        if (Networking.LocalPlayer != null)
        {
            InEditor = false;
        }

        VehicleObjectSync       = (VRC.SDK3.Components.VRCObjectSync)GetComponent(typeof(VRC.SDK3.Components.VRCObjectSync));
        ExtensionUdonBehaviours = EngineControl.ExtensionUdonBehaviours;
        VehicleRigid            = GetComponent <Rigidbody>();
    }
        protected override void Awake()
        {
            base.Awake();
            SyncPosition = true;

            rigidbody_ = GetComponent <Rigidbody>();
            sync_      = GetComponent <VRC_ObjectSync>();

#if VRC_SDK_VRCSDK2
            if ((GetComponent <Animator>() != null || GetComponent <Animation>() != null) && GetComponent <VRC_SyncAnimation>() == null)
            {
                gameObject.AddComponent <VRC_SyncAnimation>();
                this.LogWarning("Object sync has animtor or animation component but no Sync Animation component. This will be forced synced!");
            }
#endif
        }
 public static void FlagDiscontinuityHook(VRC_ObjectSync sync)
 {
     sync.GetComponent <CyanEmuObjectSyncHelper>().FlagDiscontinuity();
 }
 public static bool GetUseGravity(VRC_ObjectSync sync)
 {
     return(sync.GetComponent <CyanEmuObjectSyncHelper>().GetUseGravity());
 }
 public static bool GetIsKinematic(VRC_ObjectSync sync)
 {
     return(sync.GetComponent <CyanEmuObjectSyncHelper>().GetIsKinematic());
 }
 public static void SetUseGravity(VRC_ObjectSync sync, bool value)
 {
     sync.GetComponent <CyanEmuObjectSyncHelper>().SetUseGravity(value);
 }
 public static void SetIsKinematic(VRC_ObjectSync sync, bool value)
 {
     sync.GetComponent <CyanEmuObjectSyncHelper>().SetIsKinematic(value);
 }
 public static void RespawnObject(VRC_ObjectSync sync)
 {
     sync.GetComponent <CyanEmuObjectSyncHelper>().Respawn();
 }
 public static void TeleportTo(VRC_ObjectSync obj, Vector3 position, Quaternion rotation)
 {
     obj.GetComponent <CyanEmuObjectSyncHelper>().TeleportTo(position, rotation);
 }