Horseshoe can now be hung back up onto the door after being removed.

This commit is contained in:
Jamie Greunbaum
2024-12-02 20:38:33 -05:00
parent be4b9384af
commit 05ed27f2e3
50 changed files with 1457 additions and 299 deletions
+259 -139
View File
@@ -9,147 +9,267 @@ MonoBehaviour:
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4f11136daadff0b44ac2278a314682ab, type: 3}
m_Script: {fileID: 11500000, guid: c333ccfdd0cbdbc4ca30cef2dd6e6b9b, type: 3}
m_Name: Horseshoe
m_EditorClassIdentifier:
serializedUdonProgramAsset: {fileID: 11400000, guid: 986defec0cd397b4dbf21f7ae6ca16b7,
type: 2}
udonAssembly: ".data_start\r\n\r\n .export HorseshoeRigidBody\r\n .export
HorseshoeParentConstraint\r\n \r\n __instance_0: %UnityEngineAnimationsParentConstraint,
null\r\n __value_0: %SystemBoolean, null\r\n __instance_1: %UnityEngineRigidbody,
null\r\n __value_1: %SystemBoolean, null\r\n __instance_2: %UnityEngineAnimationsParentConstraint,
null\r\n __value_2: %SystemBoolean, null\r\n __instance_3: %UnityEngineRigidbody,
null\r\n __value_3: %SystemBoolean, null\r\n HorseshoeRigidBody: %UnityEngineRigidbody,
null\r\n HorseshoeParentConstraint: %UnityEngineAnimationsParentConstraint,
null\r\n\r\n.data_end\r\n\r\n.code_start\r\n\r\n .export _onDrop\r\n \r\n
_onDrop:\r\n \r\n PUSH, HorseshoeParentConstraint\r\n PUSH,
__instance_0\r\n COPY\r\n PUSH, __instance_0\r\n PUSH, __value_0\r\n
EXTERN, \"UnityEngineAnimationsParentConstraint.__set_enabled__SystemBoolean__SystemVoid\"\r\n
PUSH, HorseshoeRigidBody\r\n PUSH, __instance_1\r\n COPY\r\n
PUSH, __instance_1\r\n PUSH, __value_1\r\n EXTERN, \"UnityEngineRigidbody.__set_useGravity__SystemBoolean__SystemVoid\"\r\n
JUMP, 0xFFFFFFFC\r\n \r\n .export _onPickup\r\n \r\n _onPickup:\r\n
\r\n PUSH, HorseshoeParentConstraint\r\n PUSH, __instance_2\r\n
COPY\r\n PUSH, __instance_2\r\n PUSH, __value_2\r\n EXTERN,
\"UnityEngineAnimationsParentConstraint.__set_enabled__SystemBoolean__SystemVoid\"\r\n
PUSH, HorseshoeRigidBody\r\n PUSH, __instance_3\r\n COPY\r\n
PUSH, __instance_3\r\n PUSH, __value_3\r\n EXTERN, \"UnityEngineRigidbody.__set_useGravity__SystemBoolean__SystemVoid\"\r\n
JUMP, 0xFFFFFFFC\r\n \r\n\r\n.code_end\r\n"
udonAssembly:
assemblyError:
graphData:
name:
description:
nodes:
- fullName: Variable_UnityEngineRigidbody
uid: da8814ea-87fb-4a84-9c4c-7ce995422c0e
position: {x: 0, y: 0}
nodeUIDs:
-
-
-
-
-
flowUIDs: []
nodeValues:
- unityObjectValue: {fileID: 0}
stringValue:
- unityObjectValue: {fileID: 0}
stringValue: System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089|HorseshoeRigidBody
- unityObjectValue: {fileID: 0}
stringValue: System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089|True
- unityObjectValue: {fileID: 0}
stringValue: System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089|False
- unityObjectValue: {fileID: 0}
stringValue: System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089|none
- fullName: Variable_UnityEngineAnimationsParentConstraint
uid: d9308f73-e72d-49c2-ba77-22faa456003e
position: {x: 0, y: 0}
nodeUIDs:
-
-
-
-
-
flowUIDs: []
nodeValues:
- unityObjectValue: {fileID: 0}
stringValue:
- unityObjectValue: {fileID: 0}
stringValue: System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089|HorseshoeParentConstraint
- unityObjectValue: {fileID: 0}
stringValue: System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089|True
- unityObjectValue: {fileID: 0}
stringValue: System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089|False
- unityObjectValue: {fileID: 0}
stringValue: System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089|none
- fullName: Get_Variable
uid: 61acbab8-e535-408e-8bd3-d34fd64da00b
position: {x: 645.9026, y: 444.3225}
nodeUIDs:
-
flowUIDs: []
nodeValues:
- unityObjectValue: {fileID: 0}
stringValue: System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089|da8814ea-87fb-4a84-9c4c-7ce995422c0e
- unityObjectValue: {fileID: 0}
stringValue:
- fullName: UnityEngineRigidbody.__set_useGravity__SystemBoolean__SystemVoid
uid: 74ed1d8f-4b0e-4e3f-a23c-7fd46b086066
position: {x: 945, y: 308}
nodeUIDs:
- 61acbab8-e535-408e-8bd3-d34fd64da00b|0
-
flowUIDs:
-
nodeValues:
- unityObjectValue: {fileID: 0}
stringValue:
- unityObjectValue: {fileID: 0}
stringValue: System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089|True
- fullName: Get_Variable
uid: 1852c497-14aa-4ed9-a5a9-7d117282e835
position: {x: 284.00006, y: 475.80005}
nodeUIDs:
-
flowUIDs: []
nodeValues:
- unityObjectValue: {fileID: 0}
stringValue: System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089|d9308f73-e72d-49c2-ba77-22faa456003e
- unityObjectValue: {fileID: 0}
stringValue:
- fullName: UnityEngineAnimationsParentConstraint.__set_enabled__SystemBoolean__SystemVoid
uid: 5e6ea47c-d233-4de3-b786-ac4909dc896a
position: {x: 650, y: 308}
nodeUIDs:
- 1852c497-14aa-4ed9-a5a9-7d117282e835|0
-
flowUIDs:
- 74ed1d8f-4b0e-4e3f-a23c-7fd46b086066
nodeValues:
- unityObjectValue: {fileID: 0}
stringValue:
- unityObjectValue: {fileID: 0}
stringValue: System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089|False
- fullName: Event_OnDrop
uid: 05eea24f-162b-4a0a-a9f3-0d4ab782e52e
position: {x: 285.15005, y: 390.95}
nodeUIDs: []
flowUIDs:
- 5e6ea47c-d233-4de3-b786-ac4909dc896a
nodeValues: []
- fullName: Event_OnPickup
uid: a5486a94-efba-4889-a743-23070a9734b0
position: {x: 285, y: 308}
nodeUIDs: []
flowUIDs:
- 5e6ea47c-d233-4de3-b786-ac4909dc896a
nodeValues: []
updateOrder: 0
graphElementData: []
version: 1.0.0
showAssembly: 0
sourceCsScript: {fileID: 11500000, guid: 3032f97e704a83e41867561bdccd42fb, type: 3}
scriptVersion: 2
compiledVersion: 2
behaviourSyncMode: 0
hasInteractEvent: 0
scriptID: -4616404552414378418
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: 4
- Name:
Entry: 7
Data:
- Name: $k
Entry: 1
Data: IsBeingHeld
- Name: $v
Entry: 7
Data: 2|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: IsBeingHeld
- Name: <UserType>k__BackingField
Entry: 7
Data: 3|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: System.Boolean, mscorlib
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 3
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 6
Data:
- Name:
Entry: 8
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 4|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: 7
Data:
- Name: $k
Entry: 1
Data: IsInHome
- Name: $v
Entry: 7
Data: 5|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: IsInHome
- Name: <UserType>k__BackingField
Entry: 9
Data: 3
- Name: <SystemType>k__BackingField
Entry: 9
Data: 3
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 3
Data: 1
- Name:
Entry: 8
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 6|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 2
- Name:
Entry: 7
Data: 7|UdonSharp.UdonSyncedAttribute, UdonSharp.Runtime
- Name:
Entry: 8
Data:
- Name:
Entry: 7
Data: 8|UdonSharp.FieldChangeCallbackAttribute, UdonSharp.Runtime
- 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: HorseshoeConstraint
- Name: $v
Entry: 7
Data: 9|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: HorseshoeConstraint
- Name: <UserType>k__BackingField
Entry: 7
Data: 10|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: UnityEngine.Animations.ParentConstraint, UnityEngine.AnimationModule
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 10
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 6
Data:
- Name:
Entry: 8
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 11|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: 7
Data:
- Name: $k
Entry: 1
Data: HorseshoeRigidBody
- Name: $v
Entry: 7
Data: 12|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: HorseshoeRigidBody
- Name: <UserType>k__BackingField
Entry: 7
Data: 13|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: UnityEngine.Rigidbody, UnityEngine.PhysicsModule
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 13
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 6
Data:
- Name:
Entry: 8
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 14|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:
+70
View File
@@ -0,0 +1,70 @@
using UdonSharp;
using UnityEngine;
using UnityEngine.Animations;
using VRC.SDK3.ClientSim;
using VRC.SDKBase;
using VRC.Udon;
public class Horseshoe : UdonSharpBehaviour
{
private bool IsBeingHeld = false;
[UdonSynced, FieldChangeCallback(nameof(SetIsInHome))]
private bool IsInHome = true;
private ParentConstraint HorseshoeConstraint;
private Rigidbody HorseshoeRigidBody;
public void Start()
{
HorseshoeConstraint = GetComponent<ParentConstraint>();
HorseshoeRigidBody = GetComponent<Rigidbody>();
}
public override void OnPickup()
{
IsBeingHeld = true;
EnableConstraints(false);
base.OnPickup();
}
public override void OnDrop()
{
IsBeingHeld = false;
if (IsInHome)
{
EnableConstraints(true);
}
else
{
EnableConstraints(false);
}
base.OnDrop();
}
private void EnableConstraints(bool enable)
{
HorseshoeRigidBody.useGravity = !enable;
HorseshoeConstraint.enabled = enable;
}
public bool SetIsInHome
{
set
{
IsInHome = value;
if (!IsBeingHeld && IsInHome)
{
EnableConstraints(true);
}
}
get => IsInHome;
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 3032f97e704a83e41867561bdccd42fb
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,215 @@
%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: HorseshoeHomeLocation
m_EditorClassIdentifier:
serializedUdonProgramAsset: {fileID: 11400000, guid: 79f7759cb5e96b142bde0b27e0670975,
type: 2}
udonAssembly:
assemblyError:
sourceCsScript: {fileID: 11500000, guid: e9d6c68d56214fc4e9c6004b07574621, type: 3}
scriptVersion: 2
compiledVersion: 2
behaviourSyncMode: 0
hasInteractEvent: 0
scriptID: 7795716828761129294
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: 3
- Name:
Entry: 7
Data:
- Name: $k
Entry: 1
Data: Horseshoe
- Name: $v
Entry: 7
Data: 2|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: Horseshoe
- Name: <UserType>k__BackingField
Entry: 7
Data: 3|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: UnityEngine.GameObject, UnityEngine.CoreModule
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 3
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 6
Data:
- Name:
Entry: 8
Data:
- Name: <IsSerialized>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: 0
- 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: HorseshoeBehaviour
- Name: $v
Entry: 7
Data: 5|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: HorseshoeBehaviour
- Name: <UserType>k__BackingField
Entry: 7
Data: 6|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: VRC.Udon.UdonBehaviour, VRC.Udon
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 6
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 6
Data:
- Name:
Entry: 8
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 7|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: 7
Data:
- Name: $k
Entry: 1
Data: HorseshoeCollider
- Name: $v
Entry: 7
Data: 8|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: HorseshoeCollider
- Name: <UserType>k__BackingField
Entry: 7
Data: 9|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: UnityEngine.MeshCollider, UnityEngine.PhysicsModule
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 9
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 6
Data:
- Name:
Entry: 8
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 10|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:
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 50e605e4fb9c4344ca324c4fe313ff02
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,46 @@
using UdonSharp;
using UnityEngine;
using VRC.SDKBase;
using VRC.Udon;
public class HorseshoeHomeLocation : UdonSharpBehaviour
{
public GameObject Horseshoe;
private UdonBehaviour HorseshoeBehaviour;
private MeshCollider HorseshoeCollider;
public void Start()
{
HorseshoeBehaviour = Horseshoe.GetComponent<UdonBehaviour>();
HorseshoeCollider = Horseshoe.GetComponent<MeshCollider>();
}
public void OnTriggerEnter(Collider OtherCollider)
{
if (CollidingObjectIsHorseshoe(OtherCollider))
{
HorseshoeBehaviour.SetProgramVariable<bool>("IsInHome", true);
}
}
public void OnTriggerExit(Collider OtherCollider)
{
if (CollidingObjectIsHorseshoe(OtherCollider))
{
HorseshoeBehaviour.SetProgramVariable<bool>("IsInHome", false);
}
}
private bool CollidingObjectIsHorseshoe(Collider OtherCollider)
{
if (OtherCollider.Equals(HorseshoeCollider))
{
return true;
}
return false;
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e9d6c68d56214fc4e9c6004b07574621
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: