fixed skyrim issue and other smaller bugs

This commit is contained in:
Melbyj1125 2022-04-10 23:59:30 -05:00
parent dd537fdaf5
commit 0a65febafe
8 changed files with 154 additions and 73 deletions

View File

@ -5140,13 +5140,12 @@ MonoBehaviour:
curJumpNum: 0
jumpHeld: 0
canJump: 1
coyJumpTimer: 0.1
coyJumpTimer: 0.13
curCoyJumpTimer: 0.13
lowJumpMultiplier: 0.001
fallMultiplier: 1.6
isGrounded: 0
groundCheckDistance: 0.05
groundSlantDistance: 0.1
isWallRunning: 0
hookPoint: {fileID: 0}
hookPoints: []

View File

@ -3449,14 +3449,14 @@ Transform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2018109524}
m_LocalRotation: {x: 0.38268343, y: 0, z: 0, w: 0.92387956}
m_LocalPosition: {x: 31, y: 5, z: 16.4}
m_LocalRotation: {x: 0.6579316, y: -0.0005196773, z: 0.0004957008, w: 0.7530774}
m_LocalPosition: {x: 30.986458, y: -1.603281, z: 16.03299}
m_LocalScale: {x: 10, y: 1, z: 10}
m_Children:
- {fileID: 369757239}
m_Father: {fileID: 0}
m_RootOrder: 5
m_LocalEulerAnglesHint: {x: 45, y: 0, z: 0}
m_LocalEulerAnglesHint: {x: 82.285, y: -0.056, z: 0.027}
--- !u!1 &2059816015
GameObject:
m_ObjectHideFlags: 0
@ -3625,6 +3625,18 @@ 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

@ -66,14 +66,14 @@ public class Arrow : NetworkBehaviour {
//Checks if the other object is the player
MoveStateManager playerMovement = objectHit.GetComponent<MoveStateManager>();
float DirBumpX = playerMovement.driftVel.x * -1;//Inverts the Player Velocity x
float DirBumpY = .1f;
float DirBumpZ = playerMovement.driftVel.z * -1;//Inverts the Player Velocity z
Vector3 dirBump = objectHit.transform.position - transform.position;
Vector3 DirBump = new Vector3(DirBumpX, DirBumpY, DirBumpZ);//Creates a direction to launch the player
DirBump = Vector3.Normalize(DirBump);//Normalizes the vector to be used as a bump direction
dirBump.y = .1f;
if(dirBump.x == 0 && dirBump.z == 0){
dirBump = new Vector3(1,.1f,1);
}
playerMovement.GetHit(DirBump, bumpPower);
playerMovement.GetHit(dirBump.normalized, bumpPower);
//
}

View File

@ -19,14 +19,14 @@ public class Boulder : NetworkBehaviour
Debug.Log("Bump");
MoveStateManager playerMovement = objectHit.GetComponent<MoveStateManager>();
float DirBumpX = playerMovement.driftVel.x * -1;//Inverts the Player Velocity x
float DirBumpY = .1f;
float DirBumpZ = playerMovement.driftVel.z * -1;//Inverts the Player Velocity z
Vector3 dirBump = objectHit.transform.position - transform.position;
Vector3 DirBump = new Vector3(DirBumpX, DirBumpY, DirBumpZ);//Creates a direction to launch the player
DirBump = Vector3.Normalize(DirBump);//Normalizes the vector to be used as a bump direction
dirBump.y = .1f;
if(dirBump.x == 0 && dirBump.z == 0){
dirBump = new Vector3(1,.1f,1);
}
playerMovement.GetHit(DirBump, bumpPower);
playerMovement.GetHit(dirBump.normalized, bumpPower);
}
}

View File

@ -47,8 +47,8 @@ public class dAerialStateManager : NetworkBehaviour
public bool jumpHeld; // Jump is Held
public bool canJump = true; // can the player jump
bool jumpPressed; // Jamp was pressed
public float coyJumpTimer = 0.1f; // Default Coyote Jump time
public float curCoyJumpTimer = 0.1f; // current Coyote Jump time
public float coyJumpTimer = 0.13f; // Default Coyote Jump time
public float curCoyJumpTimer = 0.13f; // current Coyote Jump time
public float lowJumpMultiplier; // Short jump multiplier
public float fallMultiplier; // High Jump Multiplier
@ -58,10 +58,14 @@ public class dAerialStateManager : NetworkBehaviour
//Ground Check
public bool isGrounded; // is player grounded
public float groundCheckDistance = 0.05f; // offset distance to check ground
public float groundSlantDistance = 0.1f;
private float groundSlantDistance = .1f;
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
Ray groundRay; // ground ray
Ray angleRayLeft;
Ray angleRayRight;
Ray angleRayForward;
Ray angleRayBackwards;
RaycastHit groundHit; // ground raycast
//Wallrun
@ -231,11 +235,17 @@ public class dAerialStateManager : NetworkBehaviour
// 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);
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) > 0f)
if (Vector3.Dot(groundHit.normal, transform.up) > .8f)
{
isGrounded = true;
// handle snapping to the ground
@ -246,7 +256,36 @@ public class dAerialStateManager : NetworkBehaviour
}
}
else if(Physics.Raycast(groundRay, out groundHit, moveController.height + groundSlantDistance) && !jumpPressed && curCoyJumpTimer <= 0){
if(Vector3.Dot(groundHit.normal, transform.up) > 0f){
Debug.Log(groundHit.distance);
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){
Debug.Log(groundHit.distance);
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){
Debug.Log(groundHit.distance);
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){
Debug.Log(groundHit.distance);
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){
Debug.Log(groundHit.distance);
if(Vector3.Dot(groundHit.normal, transform.up) <= .8f){
moveController.Move(groundHit.normal * 20 * Time.deltaTime);
mSM.CancelMomentum();
}

View File

@ -51,8 +51,8 @@ public class AerialStateManager : NetworkBehaviour
public bool jumpHeld; // Jump is Held
public bool canJump = true; // can the player jump
bool jumpPressed; // Jamp was pressed
public float coyJumpTimer = 0.1f; // Default Coyote Jump time
public float curCoyJumpTimer = 0.1f; // current Coyote Jump time
public float coyJumpTimer = 0.13f; // Default Coyote Jump time
public float curCoyJumpTimer = 0.13f; // current Coyote Jump time
public float lowJumpMultiplier; // Short jump multiplier
public float fallMultiplier; // High Jump Multiplier
@ -62,10 +62,14 @@ public class AerialStateManager : NetworkBehaviour
//Ground Check
public bool isGrounded; // is player grounded
public float groundCheckDistance = 0.05f; // offset distance to check ground
public float groundSlantDistance = 0.1f;
private float groundSlantDistance = .1f;
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
Ray groundRay; // ground ray
Ray angleRayLeft;
Ray angleRayRight;
Ray angleRayForward;
Ray angleRayBackwards;
RaycastHit groundHit; // ground raycast
//Wallrun
@ -258,11 +262,17 @@ public class AerialStateManager : NetworkBehaviour
// 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);
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) > 0f)
if (Vector3.Dot(groundHit.normal, transform.up) > .8f)
{
isGrounded = true;
// handle snapping to the ground
@ -272,10 +282,37 @@ public class AerialStateManager : NetworkBehaviour
}
}
}
else if(Physics.Raycast(groundRay, out groundHit, moveController.height + groundSlantDistance) && !jumpPressed && curCoyJumpTimer <= 0 ){
if(Vector3.Dot(groundHit.normal, transform.up) > 0f){
Debug.Log("On a Slant");
// Debug.Log("The grounds Normal" + groundHit.normal);
else if(Physics.Raycast(groundRay, out groundHit, moveController.height + groundSlantDistance) && !jumpPressed && curCoyJumpTimer <= 0){
Debug.Log(groundHit.distance);
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){
Debug.Log(groundHit.distance);
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){
Debug.Log(groundHit.distance);
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){
Debug.Log(groundHit.distance);
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){
Debug.Log(groundHit.distance);
if(Vector3.Dot(groundHit.normal, transform.up) <= .8f){
moveController.Move(groundHit.normal * 20 * Time.deltaTime);
mSM.CancelMomentum();
}

View File

@ -169,9 +169,8 @@ public class PlayerStats : MonoBehaviour
}
//temp values for reseting stuff
private float tempTraction;
private float tempAcc;
private float accModification;
private float tractionModification;
private bool weatherOn = false;
////
@ -209,17 +208,13 @@ public class PlayerStats : MonoBehaviour
case Weather.Rain:{
Debug.Log("Rain");
tempTraction = traction;
tempAcc = acc;
traction -= 4;
if(curTraction - 4 > 0){
curTraction -= 4;
}
acc += 2;
curAcc += 2;
accModification = 2;
tractionModification = .5f;
traction *= tractionModification;
curTraction *= tractionModification;
accModification = 5;
acc *= accModification;
curAcc *= accModification;
break;
}
@ -227,17 +222,13 @@ public class PlayerStats : MonoBehaviour
case Weather.Snow:{
Debug.Log("Snow");
tempTraction = traction;
tempAcc = acc;
traction += 2;
if(curTraction > .01 && curTraction != 1){
curTraction += 2;
}
acc *= .5f;
curAcc *= .5f;
accModification = -acc;
tractionModification = 2f;
traction *= tractionModification;
curTraction *= tractionModification;
accModification = .5f;
acc *= accModification;
curAcc *= accModification;
curVel *= .5f;
@ -270,14 +261,15 @@ public class PlayerStats : MonoBehaviour
weatherOn = false;
acc = tempAcc;
traction = tempTraction;
acc *= (1/tractionModification);
traction *= (1/accModification);
if(curTraction > .01 && curTraction != 1){
curTraction = traction;
}
curAcc -= accModification;
curTraction *= (1/tractionModification);
curAcc *= (1/accModification);
tractionModification = 1;
accModification = 1;
windOn = false;
@ -291,23 +283,25 @@ public class PlayerStats : MonoBehaviour
bool midWeatherOn;
public void ApplySlimeBody(){
maxVel = 25;
maxVel *= .4f;
curVel = minVel;
}
//Clear slime body effect
public void ClearSlimeBody(){
maxVel = 50;
maxVel *= (1/.4f);
}
//Apply slime trail effect to the player
public void ApplySlimeTrail(){
curTraction = 1;
traction *= .3f;
curTraction *= .3f;
}
//Clear slime trail effect
public void ClearSlimeTrail(){
curTraction = traction;
traction *= (1 / .3f);
curTraction *= (1 / .3f);
}
////
void Update(){

View File

@ -12,29 +12,29 @@ EditorUserSettings:
value: 22424703114646680e0b0227036c7b151b180b650e3a233126281f3fe7c23837e1ec25a7f234362820
flags: 0
RecentlyUsedScenePath-2:
value: 22424703114646680e0b0227036c7b151b180b6501273035202c1327d1e33136e7a923e7ee2e26
value: 22424703114646680e0b0227036c78111b125507233d28242c20137df7ee3d2cfb
flags: 0
RecentlyUsedScenePath-3:
value: 22424703114646680e0b0227036c78111b125507233d28242c20137df7ee3d2cfb
value: 22424703114646680e0b0227036c731f1415016439262f2434
flags: 0
RecentlyUsedScenePath-4:
value: 22424703114646680e0b0227036c731f1415016439262f2434
flags: 0
RecentlyUsedScenePath-5:
value: 22424703114646680e0b0227036c7b151b180b6519016b0515163936efef2776f7e93ffdfe
flags: 0
RecentlyUsedScenePath-6:
RecentlyUsedScenePath-5:
value: 22424703114646680e0b0227036c731f1415016439262f2434
flags: 0
RecentlyUsedScenePath-7:
RecentlyUsedScenePath-6:
value: 22424703114646680e0b0227036c78111b125507233d28242c20137df7ee3d2cfb
flags: 0
RecentlyUsedScenePath-8:
RecentlyUsedScenePath-7:
value: 22424703114646680e0b0227036c7b151b180b650721283704240d14f0e12d3aedff78fce9332b25
flags: 0
RecentlyUsedScenePath-9:
RecentlyUsedScenePath-8:
value: 22424703114646680e0b0227036c6f02131b172b282d347e38271427fb
flags: 0
RecentlyUsedScenePath-9:
value: 22424703114646680e0b0227036c7b151b180b6501273035202c1327d1e33136e7a923e7ee2e26
flags: 0
vcSharedLogLevel:
value: 0d5e400f0650
flags: 0