From 8263edd59284aba390aca011d25b79efecef4c48 Mon Sep 17 00:00:00 2001 From: pryazha Date: Wed, 2 Jul 2025 08:46:23 -0700 Subject: init --- .../Scripts/Vector3ScaleAffordanceReceiver.cs | 33 ++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 Assets/Samples/XR Interaction Toolkit/3.1.2/Hands Interaction Demo/Scripts/Vector3ScaleAffordanceReceiver.cs (limited to 'Assets/Samples/XR Interaction Toolkit/3.1.2/Hands Interaction Demo/Scripts/Vector3ScaleAffordanceReceiver.cs') diff --git a/Assets/Samples/XR Interaction Toolkit/3.1.2/Hands Interaction Demo/Scripts/Vector3ScaleAffordanceReceiver.cs b/Assets/Samples/XR Interaction Toolkit/3.1.2/Hands Interaction Demo/Scripts/Vector3ScaleAffordanceReceiver.cs new file mode 100644 index 0000000..3845f19 --- /dev/null +++ b/Assets/Samples/XR Interaction Toolkit/3.1.2/Hands Interaction Demo/Scripts/Vector3ScaleAffordanceReceiver.cs @@ -0,0 +1,33 @@ +using System; +using Unity.Mathematics; +using UnityEngine.XR.Interaction.Toolkit.AffordanceSystem.Receiver.Primitives; + +namespace UnityEngine.XR.Interaction.Toolkit.Samples.Hands +{ + /// + /// Affordance receiver applying a Vector3 (Float3) affordance theme to a Transform local scale. + /// Broadcasts new affordance value with Unity Event. + /// + [Obsolete("The Affordance System namespace and all associated classes have been deprecated. The existing affordance system will be moved, replaced and updated with a new interaction feedback system in a future version of XRI.")] + public class Vector3ScaleAffordanceReceiver : Vector3AffordanceReceiver + { + [SerializeField] + [Tooltip("The transform to apply the scale value to.")] + Transform m_TargetTransform; + + /// + protected override void OnEnable() + { + base.OnEnable(); + if (m_TargetTransform == null) + m_TargetTransform = transform; + } + + /// + protected override void OnAffordanceValueUpdated(float3 newValue) + { + base.OnAffordanceValueUpdated(newValue); + m_TargetTransform.localScale = newValue; + } + } +} -- cgit v1.2.3-70-g09d2