From 216d9d4705d250a4f30e754e4984e08df7ea2e80 Mon Sep 17 00:00:00 2001 From: dbqt <6835629+dbqt@users.noreply.github.com> Date: Mon, 16 Sep 2024 23:07:35 -0700 Subject: [PATCH] Added scaled area prefab --- LICENSE.meta | 7 + README.md | 16 +++ README.md.meta | 7 + ScaledArea.meta | 8 ++ ScaledArea/README.md | 18 +++ ScaledArea/README.md.meta | 7 + ScaledArea/ScaledAreaPrefab.prefab | 106 ++++++++++++++ ScaledArea/ScaledAreaPrefab.prefab.meta | 7 + ScaledArea/Scripts.meta | 8 ++ ScaledArea/Scripts/ScaledArea.asset | 170 +++++++++++++++++++++++ ScaledArea/Scripts/ScaledArea.asset.meta | 8 ++ ScaledArea/Scripts/ScaledArea.cs | 28 ++++ ScaledArea/Scripts/ScaledArea.cs.meta | 11 ++ 13 files changed, 401 insertions(+) create mode 100644 LICENSE.meta create mode 100644 README.md create mode 100644 README.md.meta create mode 100644 ScaledArea.meta create mode 100644 ScaledArea/README.md create mode 100644 ScaledArea/README.md.meta create mode 100644 ScaledArea/ScaledAreaPrefab.prefab create mode 100644 ScaledArea/ScaledAreaPrefab.prefab.meta create mode 100644 ScaledArea/Scripts.meta create mode 100644 ScaledArea/Scripts/ScaledArea.asset create mode 100644 ScaledArea/Scripts/ScaledArea.asset.meta create mode 100644 ScaledArea/Scripts/ScaledArea.cs create mode 100644 ScaledArea/Scripts/ScaledArea.cs.meta diff --git a/LICENSE.meta b/LICENSE.meta new file mode 100644 index 0000000..01c37af --- /dev/null +++ b/LICENSE.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 5633ec5f292d69a49ad313c6f511a63b +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/README.md b/README.md new file mode 100644 index 0000000..b72f99b --- /dev/null +++ b/README.md @@ -0,0 +1,16 @@ +# QT World Assets + +A collection of VRC world assets. + +![GitHub](https://img.shields.io/github/license/dbqt/QTVRCWorldAssets) + +## Scaled Area + +![Imgur](https://i.imgur.com/kn64j7L.gif) + +This prefab defines an area where users will automatically be scaled to a specific height, and going out of the area will restore the height back to what it was. For example, you can have people be automatically scaled to be tiny while in the area. + +[Read more](./ScaledArea/README.md) + +## License +MIT. \ No newline at end of file diff --git a/README.md.meta b/README.md.meta new file mode 100644 index 0000000..d4ede3e --- /dev/null +++ b/README.md.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 83cac05798eb3944cb0c983990d6edf8 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/ScaledArea.meta b/ScaledArea.meta new file mode 100644 index 0000000..637cd3f --- /dev/null +++ b/ScaledArea.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b3a4ce6ad0687274d943cd75fe6b180d +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/ScaledArea/README.md b/ScaledArea/README.md new file mode 100644 index 0000000..a69cc85 --- /dev/null +++ b/ScaledArea/README.md @@ -0,0 +1,18 @@ +# Scaled Area + +This prefab defines an area where users will automatically be scaled to a specific height, and going out of the area will restore the height back to what it was. For example, you can have people be automatically scaled to be tiny while in the area. + +![Imgur](https://i.imgur.com/kn64j7L.gif) + +## Requirements +You need the latest [VRCSDK](https://creators.vrchat.com/sdk/) for worlds installed. It's recommended to use the VRChat Creator Companion to setup a project with the correct VRCSDK. + +## How to use +1. Download the latest package from the [releases](https://github.com/dbqt/QTVRCWorldAssets/releases). +2. Drag and drop the `ScaledAreaPrefab` into the scene. +3. On the instance of the prefab, on the `BoxCollider` component, adjust the size and center to cover the desired area. +4. On the instance of the prefab, on the `ScaledArea` script component, change the `Desired Scale` to the height the users in the area should be scaled to. +5. That's it! + +## Notes +If you are using this in a [Vket booth](https://event.vket.com/en), make sure to move the `Scripts` folder into the submission folder. \ No newline at end of file diff --git a/ScaledArea/README.md.meta b/ScaledArea/README.md.meta new file mode 100644 index 0000000..038802e --- /dev/null +++ b/ScaledArea/README.md.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: edffbc8bf5258f5468768dd966c86988 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/ScaledArea/ScaledAreaPrefab.prefab b/ScaledArea/ScaledAreaPrefab.prefab new file mode 100644 index 0000000..00e67c8 --- /dev/null +++ b/ScaledArea/ScaledAreaPrefab.prefab @@ -0,0 +1,106 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &1895339896486622173 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 9100918772221050587} + - component: {fileID: 7285896652736600066} + - component: {fileID: 6479759272194939642} + - component: {fileID: 1262744259757405068} + m_Layer: 0 + m_Name: ScaledAreaPrefab + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &9100918772221050587 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1895339896486622173} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &7285896652736600066 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1895339896486622173} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 787f37b05346cdc4fa83f7cd20c98b5d, type: 3} + m_Name: + m_EditorClassIdentifier: + serializationData: + SerializedFormat: 2 + SerializedBytes: + ReferencedUnityObjects: [] + SerializedBytesString: + Prefab: {fileID: 0} + PrefabModificationsReferencedUnityObjects: [] + PrefabModifications: [] + SerializationNodes: [] + _udonSharpBackingUdonBehaviour: {fileID: 6479759272194939642} + desiredScale: 1 +--- !u!114 &6479759272194939642 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1895339896486622173} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 45115577ef41a5b4ca741ed302693907, type: 3} + m_Name: + m_EditorClassIdentifier: + interactTextPlacement: {fileID: 0} + interactText: Use + interactTextGO: {fileID: 0} + proximity: 2 + SynchronizePosition: 0 + AllowCollisionOwnershipTransfer: 0 + Reliable: 0 + _syncMethod: 2 + serializedProgramAsset: {fileID: 11400000, guid: 0851618ddf396104a85e13458c8f7019, + type: 2} + programSource: {fileID: 11400000, guid: a5405da346285f64fbcdaea5b6aee437, type: 2} + serializedPublicVariablesBytesString: Ai8AAAAAATIAAABWAFIAQwAuAFUAZABvAG4ALgBDAG8AbQBtAG8AbgAuAFUAZABvAG4AVgBhAHIAaQBhAGIAbABlAFQAYQBiAGwAZQAsACAAVgBSAEMALgBVAGQAbwBuAC4AQwBvAG0AbQBvAG4AAAAAAAYBAAAAAAAAACcBBAAAAHQAeQBwAGUAAWgAAABTAHkAcwB0AGUAbQAuAEMAbwBsAGwAZQBjAHQAaQBvAG4AcwAuAEcAZQBuAGUAcgBpAGMALgBMAGkAcwB0AGAAMQBbAFsAVgBSAEMALgBVAGQAbwBuAC4AQwBvAG0AbQBvAG4ALgBJAG4AdABlAHIAZgBhAGMAZQBzAC4ASQBVAGQAbwBuAFYAYQByAGkAYQBiAGwAZQAsACAAVgBSAEMALgBVAGQAbwBuAC4AQwBvAG0AbQBvAG4AXQBdACwAIABtAHMAYwBvAHIAbABpAGIAAQEJAAAAVgBhAHIAaQBhAGIAbABlAHMALwEAAAABaAAAAFMAeQBzAHQAZQBtAC4AQwBvAGwAbABlAGMAdABpAG8AbgBzAC4ARwBlAG4AZQByAGkAYwAuAEwAaQBzAHQAYAAxAFsAWwBWAFIAQwAuAFUAZABvAG4ALgBDAG8AbQBtAG8AbgAuAEkAbgB0AGUAcgBmAGEAYwBlAHMALgBJAFUAZABvAG4AVgBhAHIAaQBhAGIAbABlACwAIABWAFIAQwAuAFUAZABvAG4ALgBDAG8AbQBtAG8AbgBdAF0ALAAgAG0AcwBjAG8AcgBsAGkAYgABAAAABgEAAAAAAAAAAi8CAAAAAUkAAABWAFIAQwAuAFUAZABvAG4ALgBDAG8AbQBtAG8AbgAuAFUAZABvAG4AVgBhAHIAaQBhAGIAbABlAGAAMQBbAFsAUwB5AHMAdABlAG0ALgBJAG4AdAAzADIALAAgAG0AcwBjAG8AcgBsAGkAYgBdAF0ALAAgAFYAUgBDAC4AVQBkAG8AbgAuAEMAbwBtAG0AbwBuAAIAAAAGAgAAAAAAAAAnAQQAAAB0AHkAcABlAAEXAAAAUwB5AHMAdABlAG0ALgBTAHQAcgBpAG4AZwAsACAAbQBzAGMAbwByAGwAaQBiACcBCgAAAFMAeQBtAGIAbwBsAE4AYQBtAGUAAR8AAABfAF8AXwBVAGQAbwBuAFMAaABhAHIAcABCAGUAaABhAHYAaQBvAHUAcgBWAGUAcgBzAGkAbwBuAF8AXwBfACcBBAAAAHQAeQBwAGUAARYAAABTAHkAcwB0AGUAbQAuAEkAbgB0ADMAMgAsACAAbQBzAGMAbwByAGwAaQBiABcBBQAAAFYAYQBsAHUAZQACAAAABwUHBQcF + publicVariablesUnityEngineObjects: [] + publicVariablesSerializationDataFormat: 0 +--- !u!65 &1262744259757405068 +BoxCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1895339896486622173} + m_Material: {fileID: 0} + m_IncludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ExcludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_LayerOverridePriority: 0 + m_IsTrigger: 1 + m_ProvidesContacts: 0 + m_Enabled: 1 + serializedVersion: 3 + m_Size: {x: 2, y: 2, z: 2} + m_Center: {x: 0, y: 1, z: 0} diff --git a/ScaledArea/ScaledAreaPrefab.prefab.meta b/ScaledArea/ScaledAreaPrefab.prefab.meta new file mode 100644 index 0000000..0f3f614 --- /dev/null +++ b/ScaledArea/ScaledAreaPrefab.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 364b931b735d99f42ae41f9ecbfac98b +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/ScaledArea/Scripts.meta b/ScaledArea/Scripts.meta new file mode 100644 index 0000000..effb10b --- /dev/null +++ b/ScaledArea/Scripts.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 543cd2db14cb39544be31001e885a26a +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/ScaledArea/Scripts/ScaledArea.asset b/ScaledArea/Scripts/ScaledArea.asset new file mode 100644 index 0000000..cf22dec --- /dev/null +++ b/ScaledArea/Scripts/ScaledArea.asset @@ -0,0 +1,170 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: c333ccfdd0cbdbc4ca30cef2dd6e6b9b, type: 3} + m_Name: ScaledArea + m_EditorClassIdentifier: + serializedUdonProgramAsset: {fileID: 11400000, guid: 0851618ddf396104a85e13458c8f7019, + type: 2} + udonAssembly: + assemblyError: + sourceCsScript: {fileID: 11500000, guid: 787f37b05346cdc4fa83f7cd20c98b5d, type: 3} + scriptVersion: 2 + compiledVersion: 2 + behaviourSyncMode: 0 + hasInteractEvent: 0 + scriptID: 5417941997435837136 + serializationData: + SerializedFormat: 2 + SerializedBytes: + ReferencedUnityObjects: [] + SerializedBytesString: + Prefab: {fileID: 0} + PrefabModificationsReferencedUnityObjects: [] + PrefabModifications: [] + SerializationNodes: + - Name: fieldDefinitions + Entry: 7 + Data: 0|System.Collections.Generic.Dictionary`2[[System.String, mscorlib],[UdonSharp.Compiler.FieldDefinition, + UdonSharp.Editor]], mscorlib + - Name: comparer + Entry: 7 + Data: 1|System.Collections.Generic.GenericEqualityComparer`1[[System.String, + mscorlib]], mscorlib + - Name: + Entry: 8 + Data: + - Name: + Entry: 12 + Data: 2 + - Name: + Entry: 7 + Data: + - Name: $k + Entry: 1 + Data: desiredScale + - Name: $v + Entry: 7 + Data: 2|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: k__BackingField + Entry: 1 + Data: desiredScale + - Name: k__BackingField + Entry: 7 + Data: 3|System.RuntimeType, mscorlib + - Name: + Entry: 1 + Data: System.Single, mscorlib + - Name: + Entry: 8 + Data: + - Name: k__BackingField + Entry: 9 + Data: 3 + - Name: k__BackingField + Entry: 7 + Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib + - Name: + Entry: 6 + Data: + - Name: + Entry: 8 + Data: + - Name: k__BackingField + Entry: 5 + Data: true + - Name: _fieldAttributes + Entry: 7 + Data: 4|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + - Name: + Entry: 12 + Data: 2 + - Name: + Entry: 7 + Data: 5|UnityEngine.SerializeField, UnityEngine.CoreModule + - Name: + Entry: 8 + Data: + - Name: + Entry: 7 + Data: 6|UnityEngine.TooltipAttribute, UnityEngine.CoreModule + - Name: tooltip + Entry: 1 + Data: Set the desired height for the avatar to scale to while inside the area + - Name: + Entry: 8 + Data: + - Name: + Entry: 13 + Data: + - Name: + Entry: 8 + Data: + - Name: + Entry: 8 + Data: + - Name: + Entry: 8 + Data: + - Name: + Entry: 7 + Data: + - Name: $k + Entry: 1 + Data: originalScale + - Name: $v + Entry: 7 + Data: 7|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: k__BackingField + Entry: 1 + Data: originalScale + - Name: k__BackingField + Entry: 9 + Data: 3 + - Name: k__BackingField + Entry: 9 + Data: 3 + - Name: k__BackingField + Entry: 7 + Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib + - Name: + Entry: 6 + Data: + - Name: + Entry: 8 + Data: + - Name: k__BackingField + Entry: 5 + Data: false + - Name: _fieldAttributes + Entry: 7 + Data: 8|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + - Name: + Entry: 12 + Data: 0 + - Name: + Entry: 13 + Data: + - Name: + Entry: 8 + Data: + - Name: + Entry: 8 + Data: + - Name: + Entry: 8 + Data: + - Name: + Entry: 13 + Data: + - Name: + Entry: 8 + Data: diff --git a/ScaledArea/Scripts/ScaledArea.asset.meta b/ScaledArea/Scripts/ScaledArea.asset.meta new file mode 100644 index 0000000..c876634 --- /dev/null +++ b/ScaledArea/Scripts/ScaledArea.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a5405da346285f64fbcdaea5b6aee437 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/ScaledArea/Scripts/ScaledArea.cs b/ScaledArea/Scripts/ScaledArea.cs new file mode 100644 index 0000000..76d0594 --- /dev/null +++ b/ScaledArea/Scripts/ScaledArea.cs @@ -0,0 +1,28 @@ + +using UdonSharp; +using UnityEngine; +using VRC.SDKBase; +using VRC.Udon; + +public class ScaledArea : UdonSharpBehaviour +{ + [SerializeField, Tooltip("Set the desired height for the avatar to scale to while inside the area")] + private float desiredScale; + + private float originalScale; + + public override void OnPlayerTriggerEnter(VRCPlayerApi player) + { + originalScale = player.GetAvatarEyeHeightAsMeters(); + player.SetAvatarEyeHeightByMeters(desiredScale); + + base.OnPlayerTriggerEnter(player); + } + + public override void OnPlayerTriggerExit(VRCPlayerApi player) + { + player.SetAvatarEyeHeightByMeters(originalScale); + + base.OnPlayerTriggerExit(player); + } +} diff --git a/ScaledArea/Scripts/ScaledArea.cs.meta b/ScaledArea/Scripts/ScaledArea.cs.meta new file mode 100644 index 0000000..76cf554 --- /dev/null +++ b/ScaledArea/Scripts/ScaledArea.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 787f37b05346cdc4fa83f7cd20c98b5d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: