void Update()
 {
     if (Networking.LocalPlayer != null)
     {
         if (!pickedUp)
         {
             // Inventory location management
             if (Networking.LocalPlayer.IsUserInVR())
             {
                 transform.position = Networking.LocalPlayer.GetTrackingData(VRCPlayerApi.TrackingDataType.LeftHand).position + new Vector3(0, 0.1f, 0);
                 transform.rotation = Networking.LocalPlayer.GetTrackingData(VRCPlayerApi.TrackingDataType.Head).rotation *initRotation;
             }
             else
             {
                 transform.position = Networking.LocalPlayer.GetPosition() + new Vector3(0.3f, 1f, 0);
                 transform.rotation = Networking.LocalPlayer.GetTrackingData(VRCPlayerApi.TrackingDataType.Head).rotation *initRotation;
             }
         }
         else
         {
             // Check if pickaxe hitbox is in solid block and if so remove it
             int[] block = generator.positionToBlockPosition(hitbox.transform.position);
             if (generator.isInBounds(block[0], block[1], block[2]) && generator.getBlockType(block[0], block[1], block[2]) != 0)
             {
                 blockSync.broadcastBlock((byte)block[0], (byte)block[1], (byte)block[2], 0);
             }
         }
     }
 }
Example #2
0
 // Place block
 public override void OnPickupUseUp()
 {
     int[] block = generator.positionToBlockPosition(hitbox.transform.position);
     if (generator.isInBounds(block[0], block[1], block[2]) && generator.getBlockType(block[0], block[1], block[2]) != type)
     {
         blockSync.broadcastBlock((byte)block[0], (byte)block[1], (byte)block[2], type);
     }
 }