From 5d3e1b5cd2c5362e0365bb59956f66b87d2e6d6c Mon Sep 17 00:00:00 2001 From: nnra6864 Date: Tue, 16 Dec 2025 07:57:18 +0100 Subject: [PATCH 01/11] Updated InteractionSystem/Core/Scripts/Hand --- Assets/SteamVR/InteractionSystem/Core/Scripts/Hand.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Assets/SteamVR/InteractionSystem/Core/Scripts/Hand.cs b/Assets/SteamVR/InteractionSystem/Core/Scripts/Hand.cs index 3890808..4b8baa8 100644 --- a/Assets/SteamVR/InteractionSystem/Core/Scripts/Hand.cs +++ b/Assets/SteamVR/InteractionSystem/Core/Scripts/Hand.cs @@ -10,7 +10,6 @@ using System.Collections.Generic; using System.Collections.ObjectModel; using UnityEngine.Events; -using System.Threading; namespace Valve.VR.InteractionSystem { @@ -1233,7 +1232,11 @@ protected virtual void FixedUpdate() { if (attachedInfo.HasAttachFlag(AttachmentFlags.VelocityMovement)) { +#if UNITY_6000_0_OR_NEWER + attachedInfo.attachedRigidbody.linearVelocity = Vector3.zero; +#else attachedInfo.attachedRigidbody.velocity = Vector3.zero; +#endif attachedInfo.attachedRigidbody.angularVelocity = Vector3.zero; } t = attachedInfo.interactable.snapAttachEaseInCurve.Evaluate(t); @@ -1265,7 +1268,11 @@ protected void UpdateAttachedVelocity(AttachedObject attachedObjectInfo) float maxAngularVelocityChange = MaxAngularVelocityChange * scale; float maxVelocityChange = MaxVelocityChange * scale; +#if UNITY_6000_0_OR_NEWER + attachedObjectInfo.attachedRigidbody.linearVelocity = Vector3.MoveTowards(attachedObjectInfo.attachedRigidbody.linearVelocity, velocityTarget, maxVelocityChange); +#else attachedObjectInfo.attachedRigidbody.velocity = Vector3.MoveTowards(attachedObjectInfo.attachedRigidbody.velocity, velocityTarget, maxVelocityChange); +#endif attachedObjectInfo.attachedRigidbody.angularVelocity = Vector3.MoveTowards(attachedObjectInfo.attachedRigidbody.angularVelocity, angularTarget, maxAngularVelocityChange); } } From 7b0cada9322dce646a0054f9165a3d093d8b9a97 Mon Sep 17 00:00:00 2001 From: nnra6864 Date: Tue, 16 Dec 2025 09:02:13 +0100 Subject: [PATCH 02/11] Updated InteractionSystem/Core/Scripts/HandCollider --- .../Core/Scripts/HandCollider.cs | 37 ++++++++++++++++++- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/Assets/SteamVR/InteractionSystem/Core/Scripts/HandCollider.cs b/Assets/SteamVR/InteractionSystem/Core/Scripts/HandCollider.cs index 6ba3286..f9ce08c 100644 --- a/Assets/SteamVR/InteractionSystem/Core/Scripts/HandCollider.cs +++ b/Assets/SteamVR/InteractionSystem/Core/Scripts/HandCollider.cs @@ -1,5 +1,3 @@ -using System.Collections; -using System.Collections.Generic; using UnityEngine; namespace Valve.VR.InteractionSystem @@ -71,8 +69,13 @@ public Transform[] this[int finger] } +#if UNITY_6000_0_OR_NEWER + private static PhysicsMaterial physicMaterial_lowfriction; + private static PhysicsMaterial physicMaterial_highfriction; +#else private static PhysicMaterial physicMaterial_lowfriction; private static PhysicMaterial physicMaterial_highfriction; +#endif private void Awake() { @@ -86,22 +89,40 @@ private void Start() if (physicMaterial_lowfriction == null) { +#if UNITY_6000_0_OR_NEWER + physicMaterial_lowfriction = new PhysicsMaterial("hand_lowFriction"); +#else physicMaterial_lowfriction = new PhysicMaterial("hand_lowFriction"); +#endif physicMaterial_lowfriction.dynamicFriction = 0; physicMaterial_lowfriction.staticFriction = 0; physicMaterial_lowfriction.bounciness = 0; +#if UNITY_6000_0_OR_NEWER + physicMaterial_lowfriction.bounceCombine = PhysicsMaterialCombine.Minimum; + physicMaterial_lowfriction.frictionCombine = PhysicsMaterialCombine.Minimum; +#else physicMaterial_lowfriction.bounceCombine = PhysicMaterialCombine.Minimum; physicMaterial_lowfriction.frictionCombine = PhysicMaterialCombine.Minimum; +#endif } if (physicMaterial_highfriction == null) { +#if UNITY_6000_0_OR_NEWER + physicMaterial_highfriction = new PhysicsMaterial("hand_highFriction"); +#else physicMaterial_highfriction = new PhysicMaterial("hand_highFriction"); +#endif physicMaterial_highfriction.dynamicFriction = 1f; physicMaterial_highfriction.staticFriction = 1f; physicMaterial_highfriction.bounciness = 0; +#if UNITY_6000_0_OR_NEWER + physicMaterial_highfriction.bounceCombine = PhysicsMaterialCombine.Minimum; + physicMaterial_highfriction.frictionCombine = PhysicsMaterialCombine.Average; +#else physicMaterial_highfriction.bounceCombine = PhysicMaterialCombine.Minimum; physicMaterial_highfriction.frictionCombine = PhysicMaterialCombine.Average; +#endif } SetPhysicMaterial(physicMaterial_lowfriction); @@ -109,7 +130,11 @@ private void Start() scale = SteamVR_Utils.GetLossyScale(hand.transform); } +#if UNITY_6000_0_OR_NEWER + void SetPhysicMaterial(PhysicsMaterial mat) +#else void SetPhysicMaterial(PhysicMaterial mat) +#endif { if (colliders == null) colliders = GetComponentsInChildren(); for (int i = 0; i < colliders.Length; i++) @@ -179,7 +204,11 @@ protected void ExecuteFixedUpdate() if (collidersInRadius == false) { //keep updating velocity, just in case. Otherwise you get jitter +#if UNITY_6000_0_OR_NEWER + rigidbody.linearVelocity = Vector3.zero; +#else rigidbody.velocity = Vector3.zero; +#endif rigidbody.angularVelocity = Vector3.zero; /* rigidbody.velocity = (targetPosition - rigidbody.position) / Time.fixedDeltaTime; @@ -200,7 +229,11 @@ protected void ExecuteFixedUpdate() float maxAngularVelocityChange = MaxAngularVelocityChange * scale; float maxVelocityChange = MaxVelocityChange * scale; +#if UNITY_6000_0_OR_NEWER + rigidbody.linearVelocity = Vector3.MoveTowards(rigidbody.linearVelocity, velocityTarget, maxVelocityChange); +#else rigidbody.velocity = Vector3.MoveTowards(rigidbody.velocity, velocityTarget, maxVelocityChange); +#endif rigidbody.angularVelocity = Vector3.MoveTowards(rigidbody.angularVelocity, angularTarget, maxAngularVelocityChange); } } From 6da0a28c5894d02c88c2d97c5f48d50b28e9a092 Mon Sep 17 00:00:00 2001 From: nnra6864 Date: Tue, 16 Dec 2025 09:04:01 +0100 Subject: [PATCH 03/11] Updated Extras/SteamVR_TestThrow --- Assets/SteamVR/Extras/SteamVR_TestThrow.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Assets/SteamVR/Extras/SteamVR_TestThrow.cs b/Assets/SteamVR/Extras/SteamVR_TestThrow.cs index 857fe91..ae52a21 100644 --- a/Assets/SteamVR/Extras/SteamVR_TestThrow.cs +++ b/Assets/SteamVR/Extras/SteamVR_TestThrow.cs @@ -1,6 +1,5 @@ //======= Copyright (c) Valve Corporation, All rights reserved. =============== using UnityEngine; -using System.Collections; namespace Valve.VR.Extras { @@ -46,12 +45,20 @@ private void FixedUpdate() Transform origin = trackedObj.origin ? trackedObj.origin : trackedObj.transform.parent; if (origin != null) { +#if UNITY_6000_0_OR_NEWER + rigidbody.linearVelocity = origin.TransformVector(trackedObj.GetVelocity()); +#else rigidbody.velocity = origin.TransformVector(trackedObj.GetVelocity()); +#endif rigidbody.angularVelocity = origin.TransformVector(trackedObj.GetAngularVelocity()); } else { +#if UNITY_6000_0_OR_NEWER + rigidbody.linearVelocity = trackedObj.GetVelocity(); +#else rigidbody.velocity = trackedObj.GetVelocity(); +#endif rigidbody.angularVelocity = trackedObj.GetAngularVelocity(); } From ca239a252e48af3921c81cc3bfd600e60b719aa8 Mon Sep 17 00:00:00 2001 From: nnra6864 Date: Tue, 16 Dec 2025 09:05:32 +0100 Subject: [PATCH 04/11] Updated InteractionSystem/Core/Scripts/InteractableDebug --- .../InteractionSystem/Core/Scripts/InteractableDebug.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Assets/SteamVR/InteractionSystem/Core/Scripts/InteractableDebug.cs b/Assets/SteamVR/InteractionSystem/Core/Scripts/InteractableDebug.cs index 9dd9a80..477d044 100644 --- a/Assets/SteamVR/InteractionSystem/Core/Scripts/InteractableDebug.cs +++ b/Assets/SteamVR/InteractionSystem/Core/Scripts/InteractableDebug.cs @@ -5,8 +5,6 @@ //============================================================================= using UnityEngine; -using UnityEngine.Events; -using System.Collections; using System.Collections.Generic; namespace Valve.VR.InteractionSystem @@ -155,7 +153,11 @@ private InteractableDebug CreateSimulation(Hand fromHand, float timeOffset, Colo Vector3 velocity = fromHand.GetTrackedObjectVelocity(timeOffset); velocity *= throwable.scaleReleaseVelocity; +#if UNITY_6000_0_OR_NEWER + debugCopy.rigidbody.linearVelocity = velocity; +#else debugCopy.rigidbody.velocity = velocity; +#endif return debugCopy; } From d900e0c9bfdd4453167f6889a3de7b9b9d95b49e Mon Sep 17 00:00:00 2001 From: nnra6864 Date: Tue, 16 Dec 2025 09:07:43 +0100 Subject: [PATCH 05/11] Updated InteractionSystem/Core/Scripts/Throwable --- .../Core/Scripts/Throwable.cs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/Assets/SteamVR/InteractionSystem/Core/Scripts/Throwable.cs b/Assets/SteamVR/InteractionSystem/Core/Scripts/Throwable.cs index 21e1cd0..5baec15 100644 --- a/Assets/SteamVR/InteractionSystem/Core/Scripts/Throwable.cs +++ b/Assets/SteamVR/InteractionSystem/Core/Scripts/Throwable.cs @@ -99,8 +99,12 @@ protected virtual void OnHandHoverBegin( Hand hand ) if ( bestGrabType != GrabTypes.None ) { +#if UNITY_6000_0_OR_NEWER + if (rigidbody.linearVelocity.magnitude >= catchingThreshold) +#else if (rigidbody.velocity.magnitude >= catchingThreshold) - { +#endif + { hand.AttachObject( gameObject, bestGrabType, attachmentFlags ); showHint = false; } @@ -174,7 +178,11 @@ protected virtual void OnDetachedFromHand(Hand hand) GetReleaseVelocities(hand, out velocity, out angularVelocity); +#if UNITY_6000_0_OR_NEWER + rigidbody.linearVelocity = velocity; +#else rigidbody.velocity = velocity; +#endif rigidbody.angularVelocity = angularVelocity; } @@ -197,7 +205,11 @@ public virtual void GetReleaseVelocities(Hand hand, out Vector3 velocity, out Ve { Debug.LogWarning("[SteamVR Interaction System] Throwable: No Velocity Estimator component on object but release style set to short estimation. Please add one or change the release style."); +#if UNITY_6000_0_OR_NEWER + velocity = rigidbody.linearVelocity; +#else velocity = rigidbody.velocity; +#endif angularVelocity = rigidbody.angularVelocity; } break; @@ -210,7 +222,11 @@ public virtual void GetReleaseVelocities(Hand hand, out Vector3 velocity, out Ve break; default: case ReleaseStyle.NoChange: +#if UNITY_6000_0_OR_NEWER + velocity = rigidbody.linearVelocity; +#else velocity = rigidbody.velocity; +#endif angularVelocity = rigidbody.angularVelocity; break; } From 667a24f358d5b58391a1757b8134cc3ec1b2e905 Mon Sep 17 00:00:00 2001 From: nnra6864 Date: Tue, 16 Dec 2025 09:12:09 +0100 Subject: [PATCH 06/11] Updated InteractionSystem/Longbow/Scripts/Arrow --- .../Longbow/Scripts/Arrow.cs | 61 ++++++++++++++++--- 1 file changed, 52 insertions(+), 9 deletions(-) diff --git a/Assets/SteamVR/InteractionSystem/Longbow/Scripts/Arrow.cs b/Assets/SteamVR/InteractionSystem/Longbow/Scripts/Arrow.cs index 3992a84..45cbb0a 100644 --- a/Assets/SteamVR/InteractionSystem/Longbow/Scripts/Arrow.cs +++ b/Assets/SteamVR/InteractionSystem/Longbow/Scripts/Arrow.cs @@ -5,7 +5,6 @@ //============================================================================= using UnityEngine; -using System.Collections; namespace Valve.VR.InteractionSystem { @@ -16,9 +15,13 @@ public class Arrow : MonoBehaviour public Rigidbody arrowHeadRB; public Rigidbody shaftRB; +#if UNITY_6000_0_OR_NEWER + public PhysicsMaterial targetPhysMaterial; +#else public PhysicMaterial targetPhysMaterial; +#endif - private Vector3 prevPosition; + private Vector3 prevPosition; private Quaternion prevRotation; private Vector3 prevVelocity; private Vector3 prevHeadPosition; @@ -48,8 +51,13 @@ public class Arrow : MonoBehaviour private void Awake() { initialMass = shaftRB.mass; +#if UNITY_6000_0_OR_NEWER + initialDrag = shaftRB.linearDamping; + initialAngularDrag = shaftRB.angularDamping; +#else initialDrag = shaftRB.drag; initialAngularDrag = shaftRB.angularDrag; +#endif initialInterpolation = shaftRB.interpolation; initialCollisionDetection = shaftRB.collisionDetectionMode; initialUseGravity = shaftRB.useGravity; @@ -70,8 +78,12 @@ void FixedUpdate() { prevPosition = transform.position; prevRotation = transform.rotation; +#if UNITY_6000_0_OR_NEWER + prevVelocity = shaftRB.linearVelocity; +#else prevVelocity = shaftRB.velocity; - prevHeadPosition = arrowHeadRB.transform.position; +#endif + prevHeadPosition = arrowHeadRB.transform.position; travelledFrames++; } } @@ -85,9 +97,14 @@ public void StartRelease() shaftRB = rb; shaftRB.mass = initialMass; +#if UNITY_6000_0_OR_NEWER + shaftRB.linearDamping = initialDrag; + shaftRB.angularDamping = initialAngularDrag; +#else shaftRB.drag = initialDrag; shaftRB.angularDrag = initialAngularDrag; - shaftRB.interpolation = initialInterpolation; +#endif + shaftRB.interpolation = initialInterpolation; shaftRB.collisionDetectionMode = initialCollisionDetection; shaftRB.useGravity = initialUseGravity; @@ -128,7 +145,11 @@ public void ArrowReleased( float inputVelocity ) prevPosition = transform.position; prevRotation = transform.rotation; prevHeadPosition = arrowHeadRB.transform.position; +#if UNITY_6000_0_OR_NEWER + prevVelocity = GetComponent().linearVelocity; +#else prevVelocity = GetComponent().velocity; +#endif SetCollisionMode(CollisionDetectionMode.ContinuousDynamic); @@ -152,8 +173,12 @@ void OnCollisionEnter( Collision collision ) if ( inFlight ) { Rigidbody rb = GetComponent(); +#if UNITY_6000_0_OR_NEWER + float rbSpeed = rb.linearVelocity.sqrMagnitude; +#else float rbSpeed = rb.velocity.sqrMagnitude; - bool canStick = ( targetPhysMaterial != null && collision.collider.sharedMaterial == targetPhysMaterial && rbSpeed > 0.2f ); +#endif + bool canStick = ( targetPhysMaterial != null && collision.collider.sharedMaterial == targetPhysMaterial && rbSpeed > 0.2f ); bool hitBalloon = collision.collider.gameObject.GetComponent() != null; if ( travelledFrames < 2 && !canStick ) @@ -162,11 +187,17 @@ void OnCollisionEnter( Collision collision ) transform.position = prevPosition - prevVelocity * Time.deltaTime; transform.rotation = prevRotation; +#if UNITY_6000_0_OR_NEWER + Vector3 reflfectDir = Vector3.Reflect(arrowHeadRB.linearVelocity, collision.contacts[0].normal); + arrowHeadRB.linearVelocity = reflfectDir * 0.25f; + shaftRB.linearVelocity = reflfectDir * 0.25f; +#else Vector3 reflfectDir = Vector3.Reflect( arrowHeadRB.velocity, collision.contacts[0].normal ); arrowHeadRB.velocity = reflfectDir * 0.25f; shaftRB.velocity = reflfectDir * 0.25f; +#endif - travelledFrames = 0; + travelledFrames = 0; return; } @@ -208,8 +239,12 @@ void OnCollisionEnter( Collision collision ) // Revert my physics properties cause I don't want balloons to influence my travel transform.position = prevPosition; transform.rotation = prevRotation; +#if UNITY_6000_0_OR_NEWER + arrowHeadRB.linearVelocity = prevVelocity; +#else arrowHeadRB.velocity = prevVelocity; - Physics.IgnoreCollision( arrowHeadRB.GetComponent(), collision.collider ); +#endif + Physics.IgnoreCollision( arrowHeadRB.GetComponent(), collision.collider ); Physics.IgnoreCollision( shaftRB.GetComponent(), collision.collider ); } @@ -261,14 +296,22 @@ private void StickInTarget( Collision collision, bool bSkipRayCast ) SetCollisionMode(CollisionDetectionMode.Discrete, true); +#if UNITY_6000_0_OR_NEWER + shaftRB.linearVelocity = Vector3.zero; +#else shaftRB.velocity = Vector3.zero; - shaftRB.angularVelocity = Vector3.zero; +#endif + shaftRB.angularVelocity = Vector3.zero; shaftRB.isKinematic = true; shaftRB.useGravity = false; shaftRB.transform.GetComponent().enabled = false; +#if UNITY_6000_0_OR_NEWER + arrowHeadRB.linearVelocity = Vector3.zero; +#else arrowHeadRB.velocity = Vector3.zero; - arrowHeadRB.angularVelocity = Vector3.zero; +#endif + arrowHeadRB.angularVelocity = Vector3.zero; arrowHeadRB.isKinematic = true; arrowHeadRB.useGravity = false; arrowHeadRB.transform.GetComponent().enabled = false; From e7a5ad3629e20749f493696f4f0467fbb9e2357a Mon Sep 17 00:00:00 2001 From: nnra6864 Date: Tue, 16 Dec 2025 09:13:16 +0100 Subject: [PATCH 07/11] Updated InteractionSystem/Longbow/Scripts/ArrowHand --- .../SteamVR/InteractionSystem/Longbow/Scripts/ArrowHand.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Assets/SteamVR/InteractionSystem/Longbow/Scripts/ArrowHand.cs b/Assets/SteamVR/InteractionSystem/Longbow/Scripts/ArrowHand.cs index 029bca2..552e2a5 100644 --- a/Assets/SteamVR/InteractionSystem/Longbow/Scripts/ArrowHand.cs +++ b/Assets/SteamVR/InteractionSystem/Longbow/Scripts/ArrowHand.cs @@ -241,8 +241,12 @@ private void FireArrow() arrow.arrowHeadRB.AddForce( currentArrow.transform.forward * bow.GetArrowVelocity(), ForceMode.VelocityChange ); arrow.arrowHeadRB.AddTorque( currentArrow.transform.forward * 10 ); +#if UNITY_6000_0_OR_NEWER + arrow.shaftRB.linearVelocity = arrow.arrowHeadRB.linearVelocity; +#else arrow.shaftRB.velocity = arrow.arrowHeadRB.velocity; - arrow.shaftRB.angularVelocity = arrow.arrowHeadRB.angularVelocity; +#endif + arrow.shaftRB.angularVelocity = arrow.arrowHeadRB.angularVelocity; nocked = false; nockedWithType = GrabTypes.None; From f126814fbd6f1c8a105ae520576735f6457eb2d7 Mon Sep 17 00:00:00 2001 From: nnra6864 Date: Tue, 16 Dec 2025 09:15:13 +0100 Subject: [PATCH 08/11] Updated InteractionSystem/Longbow/Scripts/Balloon --- .../Longbow/Scripts/Balloon.cs | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/Assets/SteamVR/InteractionSystem/Longbow/Scripts/Balloon.cs b/Assets/SteamVR/InteractionSystem/Longbow/Scripts/Balloon.cs index 61f8dcc..55343f6 100644 --- a/Assets/SteamVR/InteractionSystem/Longbow/Scripts/Balloon.cs +++ b/Assets/SteamVR/InteractionSystem/Longbow/Scripts/Balloon.cs @@ -5,7 +5,6 @@ //============================================================================= using UnityEngine; -using System.Collections; namespace Valve.VR.InteractionSystem { @@ -99,12 +98,19 @@ private void SpawnParticles( GameObject particlePrefab, SoundPlayOneshot sound ) //------------------------------------------------- void FixedUpdate() { - // Slow-clamp velocity + // Slow-clamp velocity +#if UNITY_6000_0_OR_NEWER + if (balloonRigidbody.linearVelocity.sqrMagnitude > maxVelocity) + { + balloonRigidbody.linearVelocity *= 0.97f; + } +#else if ( balloonRigidbody.velocity.sqrMagnitude > maxVelocity ) { balloonRigidbody.velocity *= 0.97f; } - } +#endif + } //------------------------------------------------- @@ -155,12 +161,19 @@ void OnCollisionEnter( Collision collision ) return; } +#if UNITY_6000_0_OR_NEWER + if (balloonRigidbody.linearVelocity.magnitude > (maxVelocity * 10)) + { + balloonRigidbody.linearVelocity = balloonRigidbody.linearVelocity.normalized * maxVelocity; + } +#else if ( balloonRigidbody.velocity.magnitude > ( maxVelocity * 10 ) ) { balloonRigidbody.velocity = balloonRigidbody.velocity.normalized * maxVelocity; } +#endif - if ( hand != null ) + if ( hand != null ) { ushort collisionStrength = (ushort)Mathf.Clamp( Util.RemapNumber( collision.relativeVelocity.magnitude, 0f, 3f, 500f, 800f ), 500f, 800f ); From 78442c3334ea6f02cfe88c85a5c2d75bc96dc4e6 Mon Sep 17 00:00:00 2001 From: nnra6864 Date: Tue, 16 Dec 2025 09:16:59 +0100 Subject: [PATCH 09/11] Updated InteractionSystem/Samples/BuggyBuddy/BuggyBuddy --- .../InteractionSystem/Samples/BuggyBuddy/BuggyBuddy.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Assets/SteamVR/InteractionSystem/Samples/BuggyBuddy/BuggyBuddy.cs b/Assets/SteamVR/InteractionSystem/Samples/BuggyBuddy/BuggyBuddy.cs index d3c0ce7..df2e6e7 100644 --- a/Assets/SteamVR/InteractionSystem/Samples/BuggyBuddy/BuggyBuddy.cs +++ b/Assets/SteamVR/InteractionSystem/Samples/BuggyBuddy/BuggyBuddy.cs @@ -1,6 +1,4 @@ using UnityEngine; -using System; -using System.Collections; namespace Valve.VR.InteractionSystem.Sample @@ -128,7 +126,11 @@ private void Update() float angle = maxAngle * steer.x; +#if UNITY_6000_0_OR_NEWER + speed = transform.InverseTransformVector(body.linearVelocity).z; +#else speed = transform.InverseTransformVector(body.velocity).z; +#endif float forw = Mathf.Abs(speed); From 7f2e20342d4f6870afa8ceeb5aba369cb07421c9 Mon Sep 17 00:00:00 2001 From: nnra6864 Date: Tue, 16 Dec 2025 09:17:46 +0100 Subject: [PATCH 10/11] Updated InteractionSystem/Samples/BuggyBuddy/LockToPoint --- .../InteractionSystem/Samples/BuggyBuddy/LockToPoint.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Assets/SteamVR/InteractionSystem/Samples/BuggyBuddy/LockToPoint.cs b/Assets/SteamVR/InteractionSystem/Samples/BuggyBuddy/LockToPoint.cs index 3b6a283..785a71e 100644 --- a/Assets/SteamVR/InteractionSystem/Samples/BuggyBuddy/LockToPoint.cs +++ b/Assets/SteamVR/InteractionSystem/Samples/BuggyBuddy/LockToPoint.cs @@ -1,5 +1,3 @@ -using System.Collections; -using System.Collections.Generic; using UnityEngine; @@ -47,7 +45,11 @@ private void FixedUpdate() { float t = Mathf.Pow(35, dropTimer); +#if UNITY_6000_0_OR_NEWER + body.linearVelocity = Vector3.Lerp(body.linearVelocity, Vector3.zero, Time.fixedDeltaTime * 4); +#else body.velocity = Vector3.Lerp(body.velocity, Vector3.zero, Time.fixedDeltaTime * 4); +#endif if (body.useGravity) body.AddForce(-Physics.gravity); From 19ceb1f0e608859606fefceac2b51d9f2271efd9 Mon Sep 17 00:00:00 2001 From: nnra6864 Date: Tue, 16 Dec 2025 09:20:03 +0100 Subject: [PATCH 11/11] Updated InteractionSystem/Samples/JoeJeff/JoeJeff --- .../Samples/JoeJeff/JoeJeff.cs | 25 +++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/Assets/SteamVR/InteractionSystem/Samples/JoeJeff/JoeJeff.cs b/Assets/SteamVR/InteractionSystem/Samples/JoeJeff/JoeJeff.cs index c918347..4191a0f 100644 --- a/Assets/SteamVR/InteractionSystem/Samples/JoeJeff/JoeJeff.cs +++ b/Assets/SteamVR/InteractionSystem/Samples/JoeJeff/JoeJeff.cs @@ -1,6 +1,4 @@ using UnityEngine; -using System.Collections; -using Valve.VR.InteractionSystem; namespace Valve.VR.InteractionSystem.Sample { @@ -95,18 +93,30 @@ public void OnAnimatorMove() { float moveFac = Mathf.InverseLerp(0, frictionTime, groundedTime); //print(moveFac); +#if UNITY_6000_0_OR_NEWER + Vector3 lerpV = Vector3.Lerp(rigidbody.linearVelocity, animationDelta, moveFac * Time.deltaTime * 30); +#else Vector3 lerpV = Vector3.Lerp(rigidbody.velocity, animationDelta, moveFac * Time.deltaTime * 30); +#endif animationDelta.x = lerpV.x; animationDelta.z = lerpV.z; } // adding a little downward force to keep him on the floor animationDelta.y += -0.2f;// rb.velocity.y; +#if UNITY_6000_0_OR_NEWER + rigidbody.linearVelocity = animationDelta; +#else rigidbody.velocity = animationDelta; +#endif } else { +#if UNITY_6000_0_OR_NEWER + rigidbody.linearVelocity += input * Time.deltaTime * airControl; +#else rigidbody.velocity += input * Time.deltaTime * airControl; +#endif } } } @@ -146,8 +156,13 @@ private void UpdateAnimator(Vector3 move) if (!isGrounded) { +#if UNITY_6000_0_OR_NEWER + animator.SetFloat("FallSpeed", Mathf.Abs(rigidbody.linearVelocity.y)); + animator.SetFloat("Jump", rigidbody.linearVelocity.y); +#else animator.SetFloat("FallSpeed", Mathf.Abs(rigidbody.velocity.y)); animator.SetFloat("Jump", rigidbody.velocity.y); +#endif } } @@ -204,9 +219,15 @@ public void Jump() jumpTimer = 0.1f; animator.applyRootMotion = false; rigidbody.position += Vector3.up * 0.03f; +#if UNITY_6000_0_OR_NEWER + Vector3 velocity = rigidbody.linearVelocity; + velocity.y = jumpVelocity; + rigidbody.linearVelocity = velocity; +#else Vector3 velocity = rigidbody.velocity; velocity.y = jumpVelocity; rigidbody.velocity = velocity; +#endif } } } \ No newline at end of file