debug skyrim no more

This commit is contained in:
Melbyj1125 2022-04-11 13:21:41 -05:00
parent a3a54af3c7
commit 2e594d859a
6 changed files with 91 additions and 50 deletions

View File

@ -976,10 +976,10 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
maxVel: 50
minVel: 18
minVel: 20
curVel: 0
hardCapMaxVel: 90
acc: 0.02
acc: 0.04
curAcc: 0
jumpPow: 60
jumpNum: 2
@ -1133,7 +1133,6 @@ MonoBehaviour:
fallMultiplier: 1.6
isGrounded: 0
groundCheckDistance: 0.05
groundSlantDistance: 0.1
isWallRunning: 0
hookPoint: {fileID: 0}
hookPoints: []

View File

@ -4988,10 +4988,10 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
maxVel: 50
minVel: 18
minVel: 20
curVel: 0
hardCapMaxVel: 90
acc: 0.02
acc: 0.04
curAcc: 0
jumpPow: 60
jumpNum: 2

View File

@ -3625,18 +3625,6 @@ PrefabInstance:
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 1707207228499037414, guid: 0ea305f96ab853340bb9f0ed320dac08, type: 3}
propertyPath: groundSlantDistance
value: 0.4
objectReference: {fileID: 0}
- target: {fileID: 1707207228499037464, guid: 0ea305f96ab853340bb9f0ed320dac08, type: 3}
propertyPath: m_SlopeLimit
value: 45
objectReference: {fileID: 0}
- target: {fileID: 1707207228499037464, guid: 0ea305f96ab853340bb9f0ed320dac08, type: 3}
propertyPath: m_StepOffset
value: 0.3
objectReference: {fileID: 0}
- target: {fileID: 5759777694531189237, guid: 0ea305f96ab853340bb9f0ed320dac08, type: 3}
propertyPath: m_RootOrder
value: 13

View File

@ -58,14 +58,20 @@ public class dAerialStateManager : NetworkBehaviour
//Ground Check
public bool isGrounded; // is player grounded
public float groundCheckDistance = 0.05f; // offset distance to check ground
private float groundSlantDistance = .05f;
private float groundSlantDistance = .3f;
const float jumpGroundingPreventionTime = 0.2f; // delay so player doesn't get snapped to ground while jumping
const float groundCheckDistanceInAir = 0.07f; // How close we have to get to ground to start checking for grounded again
Vector3 raycastOffset;
Vector3 lastPos;
Ray groundRay; // ground ray
Ray angleRayLeft;
Ray angleRayRight;
Ray angleRayForward;
Ray angleRayBackwards;
Ray angleRayLeftR;
Ray angleRayRightL;
Ray angleRayForwardB;
Ray angleRayBackwardsF;
RaycastHit groundHit; // ground raycast
//Wallrun
@ -133,6 +139,7 @@ public class dAerialStateManager : NetworkBehaviour
//Grapple Variables
hookPoints = GameObject.FindGameObjectsWithTag("HookPoint");
lastPos = transform.position;
////
}
@ -229,20 +236,38 @@ public class dAerialStateManager : NetworkBehaviour
//Checks if player is grounded
void GroundCheck(){
raycastOffset = transform.position - lastPos;
lastPos = transform.position;
// Make sure that the ground check distance while already in air is very small, to prevent suddenly snapping to ground
float chosenGroundCheckDistance = isGrounded ? (moveController.skinWidth + groundCheckDistance) : groundCheckDistanceInAir;
// reset values before the ground check
isGrounded = false;
groundRay = new Ray(moveController.transform.position, Vector3.down);
angleRayLeft = new Ray(moveController.transform.position, Quaternion.AngleAxis(45, Vector3.forward) * Vector3.left);
angleRayRight = new Ray(moveController.transform.position, Quaternion.AngleAxis(-45, Vector3.forward) * -Vector3.left);
angleRayForward = new Ray(moveController.transform.position, Quaternion.AngleAxis(-45, Vector3.left) * Vector3.forward);
angleRayBackwards = new Ray(moveController.transform.position, Quaternion.AngleAxis(45, Vector3.left) * Vector3.forward);
groundRay = new Ray(moveController.transform.position + raycastOffset, Vector3.down);
angleRayLeft = new Ray(moveController.transform.position + raycastOffset , Quaternion.AngleAxis(45, Vector3.forward) * Vector3.left);
angleRayRight = new Ray(moveController.transform.position + raycastOffset, Quaternion.AngleAxis(-45, Vector3.forward) * -Vector3.left);
angleRayForward = new Ray(moveController.transform.position + raycastOffset, Quaternion.AngleAxis(-45, Vector3.left) * Vector3.forward);
angleRayBackwards = new Ray(moveController.transform.position + raycastOffset, Quaternion.AngleAxis(45, Vector3.left) * -Vector3.forward);
angleRayLeftR = new Ray(moveController.transform.position + raycastOffset, Quaternion.AngleAxis(-45, Vector3.up) * (Quaternion.AngleAxis(45, Vector3.forward) * Vector3.left));
angleRayRightL = new Ray(moveController.transform.position + raycastOffset, Quaternion.AngleAxis(-45, Vector3.up) * (Quaternion.AngleAxis(-45, -Vector3.forward) * -Vector3.left));
angleRayForwardB = new Ray(moveController.transform.position + raycastOffset, Quaternion.AngleAxis(-45, Vector3.up) * (Quaternion.AngleAxis(-45, Vector3.left) * Vector3.forward));
angleRayBackwardsF = new Ray(moveController.transform.position + raycastOffset, Quaternion.AngleAxis(-45, Vector3.up) * (Quaternion.AngleAxis(45, -Vector3.left) * Vector3.forward));
Debug.DrawRay(moveController.transform.position, Quaternion.AngleAxis(-45, Vector3.up) * (Quaternion.AngleAxis(45, Vector3.forward) * Vector3.left) * 1000,Color.yellow);
Debug.DrawRay(moveController.transform.position, Quaternion.AngleAxis(-45, Vector3.up) * (Quaternion.AngleAxis(-45, Vector3.forward) * -Vector3.left) * 1000,Color.blue);
Debug.DrawRay(moveController.transform.position, Quaternion.AngleAxis(-45, Vector3.up) * (Quaternion.AngleAxis(-45, Vector3.left) * Vector3.forward) * 1000,Color.red);
Debug.DrawRay(moveController.transform.position, Quaternion.AngleAxis(-45, Vector3.up) * (Quaternion.AngleAxis(45, Vector3.left) * -Vector3.forward) * 1000,Color.white);
Debug.DrawRay(moveController.transform.position, Quaternion.AngleAxis(45, Vector3.forward) * Vector3.left * 1000,Color.yellow);
Debug.DrawRay(moveController.transform.position, Quaternion.AngleAxis(-45, Vector3.forward) * -Vector3.left * 1000,Color.blue);
Debug.DrawRay(moveController.transform.position, Quaternion.AngleAxis(-45, Vector3.left) * Vector3.forward * 1000,Color.red);
Debug.DrawRay(moveController.transform.position, Quaternion.AngleAxis(45, Vector3.left) * -Vector3.forward * 1000,Color.white);
//Debug.DrawRay(moveController.transform.position, Quaternion.AngleAxis(-45, Vector3.up) * (Quaternion.AngleAxis(45, Vector3.left) * Vector3.forward) * 1000,Color.white);
if (Physics.Raycast(groundRay, out groundHit, moveController.height + groundCheckDistance) && !jumpPressed)
{
//Debug.Log(Vector3.Dot(groundHit.normal, transform.up));
// Only consider this a valid ground hit if the ground normal goes in the same direction as the character up
if (Vector3.Dot(groundHit.normal, transform.up) > .8f)
@ -255,34 +280,61 @@ public class dAerialStateManager : NetworkBehaviour
}
}
}
else if(Physics.Raycast(groundRay, out groundHit, moveController.height + groundSlantDistance) && !jumpPressed && curCoyJumpTimer <= 0){
if(Vector3.Dot(groundHit.normal, transform.up) <= .8f){
moveController.Move(groundHit.normal * 20 * Time.deltaTime);
mSM.CancelMomentum();
else if(currentState != WallRunState){
if(Physics.Raycast(groundRay, out groundHit, moveController.height + groundSlantDistance) && !jumpPressed && curCoyJumpTimer <= 0){
if(Vector3.Dot(groundHit.normal, transform.up) <= .8f){
moveController.Move(groundHit.normal * 20 * Time.deltaTime);
mSM.CancelMomentum();
}
}
}
else if(Physics.Raycast(angleRayLeft, out groundHit, moveController.height + groundSlantDistance) && !jumpPressed && curCoyJumpTimer <= 0){
if(Vector3.Dot(groundHit.normal, transform.up) <= .8f){
moveController.Move(groundHit.normal * 20 * Time.deltaTime);
mSM.CancelMomentum();
else if(Physics.Raycast(angleRayLeft, out groundHit, moveController.height + groundSlantDistance) && !jumpPressed && curCoyJumpTimer <= 0){
if(Vector3.Dot(groundHit.normal, transform.up) <= .8f){
Debug.Log("Left");
moveController.Move(groundHit.normal * 20 * Time.deltaTime);
mSM.CancelMomentum();
}
}
}
else if(Physics.Raycast(angleRayRight, out groundHit, moveController.height + groundSlantDistance) && !jumpPressed && curCoyJumpTimer <= 0){
if(Vector3.Dot(groundHit.normal, transform.up) <= .8f){
moveController.Move(groundHit.normal * 20 * Time.deltaTime);
mSM.CancelMomentum();
else if(Physics.Raycast(angleRayRight, out groundHit, moveController.height + groundSlantDistance) && !jumpPressed && curCoyJumpTimer <= 0){
if(Vector3.Dot(groundHit.normal, transform.up) <= .8f){
moveController.Move(groundHit.normal * 20 * Time.deltaTime);
mSM.CancelMomentum();
}
}
}
else if(Physics.Raycast(angleRayForward, out groundHit, moveController.height + groundSlantDistance) && !jumpPressed && curCoyJumpTimer <= 0){
if(Vector3.Dot(groundHit.normal, transform.up) <= .8f){
moveController.Move(groundHit.normal * 20 * Time.deltaTime);
mSM.CancelMomentum();
else if(Physics.Raycast(angleRayForward, out groundHit, moveController.height + groundSlantDistance) && !jumpPressed && curCoyJumpTimer <= 0){
if(Vector3.Dot(groundHit.normal, transform.up) <= .8f){
moveController.Move(groundHit.normal * 20 * Time.deltaTime);
mSM.CancelMomentum();
}
}
}
else if(Physics.Raycast(angleRayBackwards, out groundHit, moveController.height + groundSlantDistance) && !jumpPressed && curCoyJumpTimer <= 0){
if(Vector3.Dot(groundHit.normal, transform.up) <= .8f){
moveController.Move(groundHit.normal * 20 * Time.deltaTime);
mSM.CancelMomentum();
else if(Physics.Raycast(angleRayBackwards, out groundHit, moveController.height + groundSlantDistance) && !jumpPressed && curCoyJumpTimer <= 0){
if(Vector3.Dot(groundHit.normal, transform.up) <= .8f){
moveController.Move(groundHit.normal * 20 * Time.deltaTime);
mSM.CancelMomentum();
}
}
else if(Physics.Raycast(angleRayLeftR, out groundHit, moveController.height + groundSlantDistance) && !jumpPressed && curCoyJumpTimer <= 0){
if(Vector3.Dot(groundHit.normal, transform.up) <= .8f){
moveController.Move(groundHit.normal * 20 * Time.deltaTime);
mSM.CancelMomentum();
}
}
else if(Physics.Raycast(angleRayRightL, out groundHit, moveController.height + groundSlantDistance) && !jumpPressed && curCoyJumpTimer <= 0){
if(Vector3.Dot(groundHit.normal, transform.up) <= .8f){
moveController.Move(groundHit.normal * 20 * Time.deltaTime);
mSM.CancelMomentum();
}
}
else if(Physics.Raycast(angleRayForwardB, out groundHit, moveController.height + groundSlantDistance) && !jumpPressed && curCoyJumpTimer <= 0){
if(Vector3.Dot(groundHit.normal, transform.up) <= .8f){
moveController.Move(groundHit.normal * 20 * Time.deltaTime);
mSM.CancelMomentum();
}
}
else if(Physics.Raycast(angleRayBackwardsF, out groundHit, moveController.height + groundSlantDistance) && !jumpPressed && curCoyJumpTimer <= 0){
if(Vector3.Dot(groundHit.normal, transform.up) <= .8f){
moveController.Move(groundHit.normal * 20 * Time.deltaTime);
mSM.CancelMomentum();
}
}
}
}

View File

@ -7,7 +7,7 @@ public class dDashDashingState : dDashBaseState
Vector3 moveDirection; // direction vector
const float maxDashTime = .8f; // max dash time
float dashDistance = 10; // distance to dash
float dashDistance = 15; // distance to dash
float dashStoppingSpeed = 0.1f; // how quickly they stop
float currentDashTime = maxDashTime; // current dash time
float dashSpeed = 12; // dash speed
@ -27,6 +27,7 @@ public class dDashDashingState : dDashBaseState
if(currentDashTime < maxDashTime){
moveDirection = dSM.transform.forward * dashDistance;
currentDashTime += dashStoppingSpeed;
dSM.pStats.GravVel = 0;
}
//if dashtimer runs out then cooldown

View File

@ -7,7 +7,7 @@ public class DashDashingState : DashBaseState
Vector3 moveDirection; // direction vector
const float maxDashTime = .8f; // max dash time
float dashDistance = 10; // distance to dash
float dashDistance = 15; // distance to dash
float dashStoppingSpeed = 0.1f; // how quickly they stop
float currentDashTime = maxDashTime; // current dash time
float dashSpeed = 12; // dash speed
@ -27,6 +27,7 @@ public class DashDashingState : DashBaseState
if(currentDashTime < maxDashTime){
moveDirection = dSM.transform.forward * dashDistance;
currentDashTime += dashStoppingSpeed;
dSM.pStats.GravVel = 0;
}
//if dashtimer runs out then cooldown