Browse Source

Added bump back

main
Joshua Reason 1 year ago
parent
commit
6a03e72f86
4 changed files with 45 additions and 3 deletions
  1. +14
    -0
      Assets/Materials/ZeroFriction.physicMaterial
  2. +8
    -0
      Assets/Materials/ZeroFriction.physicMaterial.meta
  3. +20
    -0
      Assets/Scripts/BoatController.cs
  4. +3
    -3
      Assets/Scripts/Player/BoatRowController.cs

+ 14
- 0
Assets/Materials/ZeroFriction.physicMaterial View File

@ -0,0 +1,14 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!134 &13400000
PhysicMaterial:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: ZeroFriction
dynamicFriction: 0.6
staticFriction: 0.6
bounciness: 0
frictionCombine: 0
bounceCombine: 0

+ 8
- 0
Assets/Materials/ZeroFriction.physicMaterial.meta View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: d850cf529f814714ab7042b4428b42ec
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 13400000
userData:
assetBundleName:
assetBundleVariant:

+ 20
- 0
Assets/Scripts/BoatController.cs View File

@ -13,6 +13,9 @@ public class BoatController : MonoBehaviour
[SerializeField] [SerializeField]
private float BrakeFactor = 1f; private float BrakeFactor = 1f;
[SerializeField]
private float ObstacleBounce = 2f;
[SerializeField] [SerializeField]
private bool m_usedebugkeys; private bool m_usedebugkeys;
@ -91,4 +94,21 @@ public class BoatController : MonoBehaviour
rigidBody.AddForce(rigidBody.velocity * - BrakeFactor); rigidBody.AddForce(rigidBody.velocity * - BrakeFactor);
rigidBody.AddTorque(rigidBody.angularVelocity * -BrakeFactor); rigidBody.AddTorque(rigidBody.angularVelocity * -BrakeFactor);
} }
public void OnCollisionEnter(Collision collision)
{
if (collision.gameObject.CompareTag("Obstacle"))
{
Debug.Log($"Hitting: {collision.gameObject} Foce: {collision.impulse * ObstacleBounce}");
rigidBody.AddForce(collision.impulse * ObstacleBounce, ForceMode.Impulse);
}
}
} }

+ 3
- 3
Assets/Scripts/Player/BoatRowController.cs View File

@ -104,17 +104,17 @@ public class BoatRowController : MonoBehaviour
if(averageVelocity < 0.000001) if(averageVelocity < 0.000001)
{ {
m_OnBrake.Invoke(); m_OnBrake.Invoke();
Debug.Log($"Brake! ({averageVelocity})");
//Debug.Log($"Brake! ({averageVelocity})");
} }
else else
{ {
Debug.Log($"Row! ({averageVelocity})");
//Debug.Log($"Row! ({averageVelocity})");
m_OnRow.Invoke(averageVelocity); m_OnRow.Invoke(averageVelocity);
} }
} }
else else
{ {
Debug.Log($"No Row: {averageVelocity}");
//Debug.Log($"No Row: {averageVelocity}");
m_OnBrake.Invoke(); m_OnBrake.Invoke();
} }
m_lastKnownOarPosition = localOarTipPosition; m_lastKnownOarPosition = localOarTipPosition;

Loading…
Cancel
Save