-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add PickupReferenceChanger for manipulating pickup ref each by left and right
- Loading branch information
Showing
4 changed files
with
270 additions
and
0 deletions.
There are no files selected for viewing
221 changes: 221 additions & 0 deletions
221
Packages/dev.derpynewbie.common/Runtime/PickupReferenceChanger.asset
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,221 @@ | ||
%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: PickupReferenceChanger | ||
m_EditorClassIdentifier: | ||
serializedUdonProgramAsset: {fileID: 11400000, guid: f9bb5af3541df3e4b9f4a4a30813418d, | ||
type: 2} | ||
udonAssembly: | ||
assemblyError: | ||
sourceCsScript: {fileID: 11500000, guid: 4bf7a318257db9e468ced4204a202500, type: 3} | ||
scriptVersion: 2 | ||
compiledVersion: 2 | ||
behaviourSyncMode: 1 | ||
hasInteractEvent: 0 | ||
scriptID: -2152597842425192373 | ||
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: pickupReference | ||
- Name: $v | ||
Entry: 7 | ||
Data: 2|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor | ||
- Name: <Name>k__BackingField | ||
Entry: 1 | ||
Data: pickupReference | ||
- Name: <UserType>k__BackingField | ||
Entry: 7 | ||
Data: 3|System.RuntimeType, mscorlib | ||
- Name: | ||
Entry: 1 | ||
Data: UnityEngine.Transform, 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: 1 | ||
- Name: | ||
Entry: 7 | ||
Data: 5|UnityEngine.SerializeField, UnityEngine.CoreModule | ||
- 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: leftHandReference | ||
- Name: $v | ||
Entry: 7 | ||
Data: 6|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor | ||
- Name: <Name>k__BackingField | ||
Entry: 1 | ||
Data: leftHandReference | ||
- 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: 6 | ||
Data: | ||
- Name: | ||
Entry: 8 | ||
Data: | ||
- Name: <IsSerialized>k__BackingField | ||
Entry: 5 | ||
Data: true | ||
- Name: _fieldAttributes | ||
Entry: 7 | ||
Data: 7|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib | ||
- Name: | ||
Entry: 12 | ||
Data: 1 | ||
- Name: | ||
Entry: 7 | ||
Data: 8|UnityEngine.SerializeField, UnityEngine.CoreModule | ||
- 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: rightHandReference | ||
- Name: $v | ||
Entry: 7 | ||
Data: 9|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor | ||
- Name: <Name>k__BackingField | ||
Entry: 1 | ||
Data: rightHandReference | ||
- 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: 6 | ||
Data: | ||
- Name: | ||
Entry: 8 | ||
Data: | ||
- Name: <IsSerialized>k__BackingField | ||
Entry: 5 | ||
Data: true | ||
- Name: _fieldAttributes | ||
Entry: 7 | ||
Data: 10|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib | ||
- Name: | ||
Entry: 12 | ||
Data: 1 | ||
- Name: | ||
Entry: 7 | ||
Data: 11|UnityEngine.SerializeField, UnityEngine.CoreModule | ||
- Name: | ||
Entry: 8 | ||
Data: | ||
- Name: | ||
Entry: 13 | ||
Data: | ||
- Name: | ||
Entry: 8 | ||
Data: | ||
- Name: | ||
Entry: 8 | ||
Data: | ||
- Name: | ||
Entry: 8 | ||
Data: | ||
- Name: | ||
Entry: 13 | ||
Data: | ||
- Name: | ||
Entry: 8 | ||
Data: |
8 changes: 8 additions & 0 deletions
8
Packages/dev.derpynewbie.common/Runtime/PickupReferenceChanger.asset.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
30 changes: 30 additions & 0 deletions
30
Packages/dev.derpynewbie.common/Runtime/PickupReferenceChanger.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
using UdonSharp; | ||
using UnityEngine; | ||
using VRC.SDK3.Components; | ||
using VRC.SDKBase; | ||
|
||
namespace DerpyNewbie.Common | ||
{ | ||
[UdonBehaviourSyncMode(BehaviourSyncMode.None)] | ||
public class PickupReferenceChanger : UdonSharpBehaviour | ||
{ | ||
[SerializeField] private VRCPickup pickup; | ||
[SerializeField] private Transform pickupReference; | ||
[SerializeField] private Transform leftHandReference; | ||
[SerializeField] private Transform rightHandReference; | ||
|
||
public override void OnPickup() | ||
{ | ||
_SetPickupReference( | ||
pickup.currentHand == VRC_Pickup.PickupHand.Left | ||
? leftHandReference | ||
: rightHandReference | ||
); | ||
} | ||
|
||
private void _SetPickupReference(Transform t) | ||
{ | ||
pickupReference.SetPositionAndRotation(t.position, t.rotation); | ||
} | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
Packages/dev.derpynewbie.common/Runtime/PickupReferenceChanger.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.