diff --git a/Assets/Scenes/BoatTest.unity b/Assets/Scenes/BoatTest.unity
index 585a17e..9358a43 100644
--- a/Assets/Scenes/BoatTest.unity
+++ b/Assets/Scenes/BoatTest.unity
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
-oid sha256:51c8759d1d74c0e958bb8df7ddfd88a5e93a301bf4e288b3bd02954940af9ae5
-size 47470
+oid sha256:158ac3952298588515fa35a0745bc6f11a9742fd518cc57c6a55c1aebe060ce9
+size 71134
diff --git a/Assets/Scenes/Development/CharacterControllerTest.unity b/Assets/Scenes/Development/CharacterControllerTest.unity
index bb4166a..c8f91d9 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:0a34ad1f5f427168262f727710e42c70ece3e600a53b591e39835d2c425d426a
-size 21726
+oid sha256:24894f68749013207500f5f502e5ef2753c5be9a2b2b74009445948336e95510
+size 8513
diff --git a/Assets/Scenes/Utility.meta b/Assets/Scenes/Utility.meta
new file mode 100644
index 0000000..9385599
--- /dev/null
+++ b/Assets/Scenes/Utility.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: f29057d258e1d49459df24e6862140e7
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Scenes/Utility/CopyTransform.cs b/Assets/Scenes/Utility/CopyTransform.cs
new file mode 100644
index 0000000..d625d03
--- /dev/null
+++ b/Assets/Scenes/Utility/CopyTransform.cs
@@ -0,0 +1,87 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+using NaughtyAttributes;
+
+
+///
+/// Utility script to fake parent an object to another
+///
+public class CopyTransform : MonoBehaviour
+{
+
+ #region Inspector Fields
+ [SerializeField, BoxGroup("References")]
+ public Transform m_target;
+
+ [SerializeField, Range(0, 1)]
+ public float m_dampening = 1;
+ #endregion Inspector Fields
+
+ #region Private Fields
+
+ private Vector3 m_positionOffset;
+ private Quaternion m_rotationOffset;
+
+
+ #endregion Private Fields
+
+ #region Getters
+
+ #endregion Getters
+
+
+
+ #region MonoBehaviour Functions
+
+ private void Awake()
+ {
+ m_positionOffset = transform.position - m_target.position;
+ m_rotationOffset = m_target.rotation * Quaternion.Inverse(transform.rotation);
+ }
+
+ ///
+ /// OnEnable is called when the object becomes enabled and active.
+ ///
+ private void OnEnable()
+ {
+
+ }
+
+ ///
+ /// OnDisable is called when the behaviour becomes disabled.
+ ///
+ private void OnDisable()
+ {
+
+ }
+
+ ///
+ /// Update is called once per frame
+ ///
+ private void FixedUpdate()
+ {
+ Vector3 expectedPosition = m_target.position + (m_target.rotation * m_positionOffset);
+ Quaternion expectedRotation = m_target.rotation * m_rotationOffset;
+
+ transform.position = Vector3.Lerp(transform.position, expectedPosition, m_dampening);
+ transform.rotation = Quaternion.Lerp(transform.rotation, expectedRotation, m_dampening);
+ }
+
+ #endregion MonoBehaviour Functions
+
+ #region Class Functionality
+
+ #endregion Class Functionality
+
+ #region Editor Functions
+ ///
+ /// Called when the Component is created or Reset from the Inspector
+ ///
+ private void Reset()
+ {
+ //useful for finding components on creation
+ }
+ #endregion Editor Functions
+
+}
\ No newline at end of file
diff --git a/Assets/Scenes/Utility/CopyTransform.cs.meta b/Assets/Scenes/Utility/CopyTransform.cs.meta
new file mode 100644
index 0000000..614532a
--- /dev/null
+++ b/Assets/Scenes/Utility/CopyTransform.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 402a55c05df6014479f29432c30e3873
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Scripts/BoatController.cs b/Assets/Scripts/BoatController.cs
index 6fe2c01..65a9423 100644
--- a/Assets/Scripts/BoatController.cs
+++ b/Assets/Scripts/BoatController.cs
@@ -13,6 +13,9 @@ public class BoatController : MonoBehaviour
[SerializeField]
private float BrakeFactor = 1f;
+ [SerializeField]
+ private bool m_usedebugkeys;
+
void Awake()
{
rigidBody = GetComponent();
@@ -21,6 +24,9 @@ public class BoatController : MonoBehaviour
// Update is called once per frame
void Update()
{
+ if (!m_usedebugkeys)
+ return;
+
//get input
if (Input.GetKeyDown(KeyCode.A))
{
@@ -38,7 +44,7 @@ public class BoatController : MonoBehaviour
private void FixedUpdate()
{
- print(transform.rotation.eulerAngles.y);
+ //print(transform.rotation.eulerAngles.y);
//constrain rotation
if (transform.rotation.eulerAngles.y > 180 && transform.rotation.eulerAngles.y < 270)
{
diff --git a/Assets/Scripts/Player/BoatRowController.cs b/Assets/Scripts/Player/BoatRowController.cs
index 33f0c18..d316f06 100644
--- a/Assets/Scripts/Player/BoatRowController.cs
+++ b/Assets/Scripts/Player/BoatRowController.cs
@@ -2,7 +2,8 @@ using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using NaughtyAttributes;
-
+using Unity.VisualScripting;
+using UnityEngine.Events;
///
///
@@ -11,8 +12,8 @@ public class BoatRowController : MonoBehaviour
{
#region Inspector Fields
- public Collider m_oar;
public Transform m_oarTip;
+ public UnityEvent m_OnRow;
#endregion Inspector Fields
#region Private Fields
@@ -56,7 +57,8 @@ public class BoatRowController : MonoBehaviour
private void OnTriggerEnter(Collider other)
{
- if(other == m_oar)
+ OarController oar = other.GetComponentInParent();
+ if (oar != null)
{
m_lastKnownOarPosition = m_oarTip.position;
}
@@ -64,13 +66,30 @@ public class BoatRowController : MonoBehaviour
void OnTriggerStay(Collider other)
{
- if(other == m_oar)
+ OarController oar = other.GetComponentInParent();
+ if(oar != null)
{
Vector3 direction = m_lastKnownOarPosition - m_oarTip.position;
direction = Vector3.Project(direction,transform.forward);
-
- }
+ float directionality = Vector3.Dot(direction,transform.forward);
+
+ if (directionality > 0)
+ {
+ // Debug.Log($"Row! ({directionality})");
+ m_OnRow.Invoke();
+ }
+ else
+ {
+ // Debug.Log($"No Row: {directionality}");
+ }
+ m_lastKnownOarPosition=m_oarTip.position;
+ }
+ else
+ {
+ // Debug.Log($"Not Oar: {other.gameObject}");
+ }
+
}
diff --git a/Assets/Scripts/Player/OarController.cs b/Assets/Scripts/Player/OarController.cs
index af87e89..efa9b23 100644
--- a/Assets/Scripts/Player/OarController.cs
+++ b/Assets/Scripts/Player/OarController.cs
@@ -96,8 +96,8 @@ public class OarController : MonoBehaviour
Quaternion rotation = Quaternion.LookRotation(forward, direction);
- transform.rotation = rotation;
- transform.position = m_rightHand.transform.position - direction * m_distanceFromRightHand;
+ //transform.rotation = rotation;
+ //transform.position = m_rightHand.transform.position - direction * m_distanceFromRightHand;
//MoveOarToPosition(m_rightHand.transform.position - direction * m_distanceFromRightHand);
m_oarRigidbody.MoveRotation(rotation);
m_oarRigidbody.MovePosition(m_rightHand.transform.position - direction * m_distanceFromRightHand);
@@ -128,33 +128,19 @@ public class OarController : MonoBehaviour
Collider[] col = Physics.OverlapBox(transform.position + m_boxCollider.center, m_boxCollider.size / 2, rotation);
if (col.Intersect(m_forbiddenColliders).Any())
{
-
+ Debug.Log($"Forbidden collision: {string.Join(", ", col.Intersect(m_forbiddenColliders))}");
return true;
}
- return false;
-
-
- }
-
-/*
- void OnCollisionEnter(Collision collision)
- {
-
- if (m_forbiddenColliders.Contains(collision.collider) && !undoDoneThisFrame)
- {
- Debug.Log($"Forbidden Collision: {collision.collider.gameObject}");
- undoDoneThisFrame= true;
- m_leftHand.UndoLastMovement();
- m_rightHand.UndoLastMovement();
- }
else
{
- Debug.Log($"Ignored Collision: {collision.collider.gameObject}");
+ Debug.Log($"Ignored collision: {string.Join(", ", col.Except(m_forbiddenColliders))}");
}
+ return false;
+ }
+
- }*/
#endregion Class Functionality
diff --git a/Assets/Scripts/Player/PlayerController.cs b/Assets/Scripts/Player/PlayerController.cs
index d86929c..9f17d39 100644
--- a/Assets/Scripts/Player/PlayerController.cs
+++ b/Assets/Scripts/Player/PlayerController.cs
@@ -36,7 +36,7 @@ public class PlayerController : MonoBehaviour
///
private void OnEnable()
{
-
+ rightHand.UpdateHand(Vector2.up);
}
///
@@ -52,17 +52,20 @@ public class PlayerController : MonoBehaviour
///
private void FixedUpdate()
{
- leftHand.UpdateHand(leftHand.m_desiredInput);
- rightHand.UpdateHand(rightHand.m_desiredInput);
-
- oar.UpdateTransform();
if (oar.isColliding())
{
leftHand.UndoLastMovement();
rightHand.UndoLastMovement();
-
+ oar.UpdateTransform();
}
+
+ leftHand.UpdateHand(leftHand.m_desiredInput);
+ rightHand.UpdateHand(rightHand.m_desiredInput);
+
+ oar.UpdateTransform();
+
+
}
#endregion MonoBehaviour Functions
diff --git a/ProjectSettings/DynamicsManager.asset b/ProjectSettings/DynamicsManager.asset
index 6827b69..82cb6a6 100644
--- a/ProjectSettings/DynamicsManager.asset
+++ b/ProjectSettings/DynamicsManager.asset
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
-oid sha256:c180f985770287728278a4dc939c76a04d76b519697ff906c33d202fd44e1a1e
+oid sha256:26dcf28468677832b76ff313e6c988e4a24bf42d3d7103a86964843d265f582a
size 1323
diff --git a/ProjectSettings/TagManager.asset b/ProjectSettings/TagManager.asset
index 0c8c80b..6e981f6 100644
--- a/ProjectSettings/TagManager.asset
+++ b/ProjectSettings/TagManager.asset
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
-oid sha256:28529725e71fa58fdb2277e07306508472f8b936b0c5a6b386c90f1f4d415453
-size 390
+oid sha256:257adc2e17b69e053a710c5d8e6a52820e964684ee546ec36f9411e1609b7055
+size 394