mirror of
https://github.com/Leahnaya/TheKingsRace.git
synced 2026-08-21 09:54:28 -05:00
adjusted momentum loss
This commit is contained in:
@@ -63,7 +63,7 @@ public class MoveStateManager : NetworkBehaviour
|
||||
public Vector3 driftVel; // Lerped Movement Vector
|
||||
public float calculatedCurVel; // calculated current vel using driftVel
|
||||
public int layerMask; // LayerMask to exclude player
|
||||
RaycastHit wallHitTop, wallHitBot; // Raycast for momentum loss on wall hit
|
||||
RaycastHit wallHitTop, wallHitBot, wallExitTop, wallExitBot; // Raycast for momentum loss on wall hit
|
||||
private Vector3 lastVel; // previous vel
|
||||
private bool firstWallHit = false; // hit the wall for the first time
|
||||
|
||||
@@ -226,22 +226,22 @@ public class MoveStateManager : NetworkBehaviour
|
||||
|
||||
|
||||
//Check if wall is in direction player is moving
|
||||
if (((Physics.Raycast(gameObject.transform.position + new Vector3(0,.4f,0) + rayOffset, driftVel.normalized, out wallHitBot, .18f, layerMask) == true) || ((currentState != SlideState || currentState != CrouchState) && (Physics.Raycast(gameObject.transform.position + new Vector3(0,2.2f,0), driftVel.normalized, out wallHitTop, .18f, layerMask) == true))) && !firstWallHit){
|
||||
if (((Physics.Raycast(gameObject.transform.position + new Vector3(0,.4f,0) + rayOffset, driftVel.normalized, out wallHitBot, .5f, layerMask) == true) || ((currentState != SlideState || currentState != CrouchState) && (Physics.Raycast(gameObject.transform.position + new Vector3(0,2.2f,0), driftVel.normalized, out wallHitTop, .5f, layerMask) == true))) && !firstWallHit){
|
||||
CancelMomentum();
|
||||
Debug.Log("Collide");
|
||||
//Debug.Log(wallHitBot.collider.name);
|
||||
firstWallHit = true;
|
||||
}
|
||||
if(((Physics.Raycast(gameObject.transform.position + new Vector3(0,.4f,0) + rayOffset, driftVel.normalized, out wallExitBot, .3f, layerMask) == false) && ((currentState == SlideState || currentState == CrouchState) || (Physics.Raycast(gameObject.transform.position + new Vector3(0,2.2f,0), driftVel.normalized, out wallExitTop, .3f, layerMask) == false))) && firstWallHit){
|
||||
firstWallHit = false;
|
||||
}
|
||||
|
||||
Debug.DrawRay(gameObject.transform.position + new Vector3(0,.4f,0) + (rayOffset/2), moveXZ.normalized * .2f, Color.red);
|
||||
Debug.DrawRay(gameObject.transform.position + new Vector3(0,2.2f,0) + rayOffset, moveXZ.normalized * .2f, Color.red);
|
||||
Debug.DrawRay(gameObject.transform.position + new Vector3(0,.4f,0) + rayOffset, driftVel.normalized * .5f, Color.red);
|
||||
Debug.DrawRay(gameObject.transform.position + new Vector3(0,2.2f,0) + rayOffset, driftVel.normalized * .5f, Color.red);
|
||||
|
||||
|
||||
if(driftVel != Vector3.zero){
|
||||
playerModel.transform.rotation = Quaternion.LookRotation(driftVel.normalized);
|
||||
}
|
||||
|
||||
|
||||
//Actually move he player
|
||||
moveController.Move(driftVel);
|
||||
|
||||
Reference in New Issue
Block a user