|
|
@ -13,6 +13,9 @@ public class BoatController : MonoBehaviour |
|
|
|
[SerializeField] |
|
|
|
private float BrakeFactor = 1f; |
|
|
|
|
|
|
|
[SerializeField] |
|
|
|
private float ObstacleBounce = 2f; |
|
|
|
|
|
|
|
[SerializeField] |
|
|
|
private bool m_usedebugkeys; |
|
|
|
|
|
|
@ -91,4 +94,21 @@ public class BoatController : MonoBehaviour |
|
|
|
rigidBody.AddForce(rigidBody.velocity * - 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); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |