From 5ed9edabc9631ff200c4913683e17a37285f3274 Mon Sep 17 00:00:00 2001 From: Joshua Date: Sat, 4 Feb 2023 18:45:22 +1100 Subject: [PATCH] Removed physics on oar --- .../Scenes/Development/CharacterControllerTest.unity | 2 +- Assets/Scripts/Player/HandController.cs | 4 +++- Assets/Scripts/Player/OarController.cs | 12 ++++++------ 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/Assets/Scenes/Development/CharacterControllerTest.unity b/Assets/Scenes/Development/CharacterControllerTest.unity index 0de0bad..59e9f53 100644 --- a/Assets/Scenes/Development/CharacterControllerTest.unity +++ b/Assets/Scenes/Development/CharacterControllerTest.unity @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6e0cc9fb1eb2caf55429823d267246cb81ddc50428e94e872162198b0dac52e9 +oid sha256:7e3fae2868c248532c42cee9b3c5ea07d8e2d334e0c4bc30f316ef1c050c34c9 size 19170 diff --git a/Assets/Scripts/Player/HandController.cs b/Assets/Scripts/Player/HandController.cs index 7f9ef2c..a1802b8 100644 --- a/Assets/Scripts/Player/HandController.cs +++ b/Assets/Scripts/Player/HandController.cs @@ -129,6 +129,8 @@ public class HandController : MonoBehaviour } } + if (m_oar.isColliding()) + UndoLastMovement(); } @@ -136,7 +138,7 @@ public class HandController : MonoBehaviour { Vector3 direction = m_lastPosition - transform.localPosition; - transform.localPosition += direction; + transform.localPosition = m_lastPosition; } diff --git a/Assets/Scripts/Player/OarController.cs b/Assets/Scripts/Player/OarController.cs index 6d4d589..bf8a197 100644 --- a/Assets/Scripts/Player/OarController.cs +++ b/Assets/Scripts/Player/OarController.cs @@ -96,10 +96,10 @@ public class OarController : MonoBehaviour Quaternion rotation = Quaternion.LookRotation(forward, direction); - MoveOarToPosition(m_rightHand.transform.position - direction * m_distanceFromRightHand); - //m_oarRigidbody.MoveRotation(rotation); - //m_oarRigidbody.MovePosition(m_rightHand.transform.position - direction * m_distanceFromRightHand); - MoveOarToRotation(rotation); + //MoveOarToPosition(m_rightHand.transform.position - direction * m_distanceFromRightHand); + m_oarRigidbody.MoveRotation(rotation); + m_oarRigidbody.MovePosition(m_rightHand.transform.position - direction * m_distanceFromRightHand); + //MoveOarToRotation(rotation); } @@ -134,7 +134,7 @@ public class OarController : MonoBehaviour } - +/* void OnCollisionEnter(Collision collision) { @@ -152,7 +152,7 @@ public class OarController : MonoBehaviour - } + }*/ #endregion Class Functionality