grapple is more consistent and has a better momentum fall off on release

This commit is contained in:
Melbyj1125
2022-02-04 19:54:14 -06:00
parent e846ebc8c8
commit 0188b9aa17
3 changed files with 138 additions and 83 deletions

View File

@@ -5,7 +5,7 @@ using UnityEngine;
public class dGrapplingHook : NetworkBehaviour
{
public float maxGrappleDistance = 15;
public float maxGrappleDistance = 18;
public bool isGrappled;
private int hookPointIndex;
@@ -114,9 +114,9 @@ public class dGrapplingHook : NetworkBehaviour
if (Input.GetKey(KeyCode.RightShift) || Input.GetKey(KeyCode.JoystickButton5))
{
ropeLength -= climbRate * Time.deltaTime;
if (ropeLength < 5)
if (ropeLength < 8)
{
ropeLength = 5;
ropeLength = 8;
}
//Debug.Log(ropeLength.ToString());
}
@@ -155,7 +155,9 @@ public class dGrapplingHook : NetworkBehaviour
swingback = true;
if(release){
lerpRelease = Vector3.Lerp(lerpRelease, tempRelease, 10 * Time.deltaTime);
lerpRelease = Vector3.Lerp(lerpRelease, tempRelease, 10f * Time.deltaTime);
tempRelease *= .99f;
Debug.Log(lerpRelease);
movementController.Move(lerpRelease);
}
@@ -304,7 +306,9 @@ public class dGrapplingHook : NetworkBehaviour
}
Vector3 CalculateSwingReleaseForce(){
Vector3 releaseSwingForceDirection = momDirection * (swingMom + 20);
Vector3 releaseSwingForceDirection = momDirection * ((swingMom) + 10);
releaseSwingForceDirection = new Vector3(releaseSwingForceDirection.x,0,releaseSwingForceDirection.z);
if(swingMom < 5){