mirror of
https://github.com/Leahnaya/TheKingsRace.git
synced 2026-08-21 09:54:28 -05:00
Added body parts to networked player
This commit is contained in:
@@ -28,6 +28,10 @@ public class dAerialStateManager : NetworkBehaviour
|
||||
////Objects Sections
|
||||
GameObject parentObj; // Parent object
|
||||
public Camera cam;
|
||||
public GameObject stickyHandParent;
|
||||
public LineRenderer lr;
|
||||
public CharacterController handController;
|
||||
public Transform handPosition;
|
||||
////
|
||||
|
||||
////Components Section
|
||||
@@ -58,7 +62,7 @@ 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 = .3f;
|
||||
private float groundSlantDistance = .2f;
|
||||
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;
|
||||
@@ -282,56 +286,65 @@ public class dAerialStateManager : NetworkBehaviour
|
||||
}
|
||||
else if(currentState != WallRunState){
|
||||
if(Physics.Raycast(groundRay, out groundHit, moveController.height + groundSlantDistance) && !jumpPressed && curCoyJumpTimer <= 0){
|
||||
if(Vector3.Dot(groundHit.normal, transform.up) <= .8f){
|
||||
if(Vector3.Dot(groundHit.normal, transform.up) <= .8f && Vector3.Dot(groundHit.normal, transform.up) > 0f ){
|
||||
moveController.Move(groundHit.normal * 20 * Time.deltaTime);
|
||||
Debug.Log(Vector3.Dot(groundHit.normal, transform.up) );
|
||||
mSM.CancelMomentum();
|
||||
}
|
||||
}
|
||||
else if(Physics.Raycast(angleRayLeft, out groundHit, moveController.height + groundSlantDistance) && !jumpPressed && curCoyJumpTimer <= 0){
|
||||
if(Vector3.Dot(groundHit.normal, transform.up) <= .8f){
|
||||
if(Vector3.Dot(groundHit.normal, transform.up) <= .8f && Vector3.Dot(groundHit.normal, transform.up) > 0f ){
|
||||
moveController.Move(groundHit.normal * 20 * Time.deltaTime);
|
||||
Debug.Log(Vector3.Dot(groundHit.normal, transform.up) );
|
||||
mSM.CancelMomentum();
|
||||
}
|
||||
}
|
||||
else if(Physics.Raycast(angleRayRight, out groundHit, moveController.height + groundSlantDistance) && !jumpPressed && curCoyJumpTimer <= 0){
|
||||
if(Vector3.Dot(groundHit.normal, transform.up) <= .8f){
|
||||
if(Vector3.Dot(groundHit.normal, transform.up) <= .8f && Vector3.Dot(groundHit.normal, transform.up) > 0f ){
|
||||
moveController.Move(groundHit.normal * 20 * Time.deltaTime);
|
||||
Debug.Log(Vector3.Dot(groundHit.normal, transform.up) );
|
||||
mSM.CancelMomentum();
|
||||
}
|
||||
}
|
||||
else if(Physics.Raycast(angleRayForward, out groundHit, moveController.height + groundSlantDistance) && !jumpPressed && curCoyJumpTimer <= 0){
|
||||
if(Vector3.Dot(groundHit.normal, transform.up) <= .8f){
|
||||
if(Vector3.Dot(groundHit.normal, transform.up) <= .8f && Vector3.Dot(groundHit.normal, transform.up) > 0f ){
|
||||
moveController.Move(groundHit.normal * 20 * Time.deltaTime);
|
||||
Debug.Log(Vector3.Dot(groundHit.normal, transform.up) );
|
||||
mSM.CancelMomentum();
|
||||
}
|
||||
}
|
||||
else if(Physics.Raycast(angleRayBackwards, out groundHit, moveController.height + groundSlantDistance) && !jumpPressed && curCoyJumpTimer <= 0){
|
||||
if(Vector3.Dot(groundHit.normal, transform.up) <= .8f){
|
||||
if(Vector3.Dot(groundHit.normal, transform.up) <= .8f && Vector3.Dot(groundHit.normal, transform.up) > 0f ){
|
||||
moveController.Move(groundHit.normal * 20 * Time.deltaTime);
|
||||
Debug.Log(Vector3.Dot(groundHit.normal, transform.up) );
|
||||
mSM.CancelMomentum();
|
||||
}
|
||||
}
|
||||
else if(Physics.Raycast(angleRayLeftR, out groundHit, moveController.height + groundSlantDistance) && !jumpPressed && curCoyJumpTimer <= 0){
|
||||
if(Vector3.Dot(groundHit.normal, transform.up) <= .8f){
|
||||
if(Vector3.Dot(groundHit.normal, transform.up) <= .8f && Vector3.Dot(groundHit.normal, transform.up) > 0f ){
|
||||
moveController.Move(groundHit.normal * 20 * Time.deltaTime);
|
||||
Debug.Log(Vector3.Dot(groundHit.normal, transform.up) );
|
||||
mSM.CancelMomentum();
|
||||
}
|
||||
}
|
||||
else if(Physics.Raycast(angleRayRightL, out groundHit, moveController.height + groundSlantDistance) && !jumpPressed && curCoyJumpTimer <= 0){
|
||||
if(Vector3.Dot(groundHit.normal, transform.up) <= .8f){
|
||||
if(Vector3.Dot(groundHit.normal, transform.up) <= .8f && Vector3.Dot(groundHit.normal, transform.up) > 0f ){
|
||||
moveController.Move(groundHit.normal * 20 * Time.deltaTime);
|
||||
Debug.Log(Vector3.Dot(groundHit.normal, transform.up) );
|
||||
mSM.CancelMomentum();
|
||||
}
|
||||
}
|
||||
else if(Physics.Raycast(angleRayForwardB, out groundHit, moveController.height + groundSlantDistance) && !jumpPressed && curCoyJumpTimer <= 0){
|
||||
if(Vector3.Dot(groundHit.normal, transform.up) <= .8f){
|
||||
if(Vector3.Dot(groundHit.normal, transform.up) <= .8f && Vector3.Dot(groundHit.normal, transform.up) > 0f ){
|
||||
moveController.Move(groundHit.normal * 20 * Time.deltaTime);
|
||||
Debug.Log(Vector3.Dot(groundHit.normal, transform.up) );
|
||||
mSM.CancelMomentum();
|
||||
}
|
||||
}
|
||||
else if(Physics.Raycast(angleRayBackwardsF, out groundHit, moveController.height + groundSlantDistance) && !jumpPressed && curCoyJumpTimer <= 0){
|
||||
if(Vector3.Dot(groundHit.normal, transform.up) <= .8f){
|
||||
if(Vector3.Dot(groundHit.normal, transform.up) <= .8f && Vector3.Dot(groundHit.normal, transform.up) > 0f ){
|
||||
moveController.Move(groundHit.normal * 20 * Time.deltaTime);
|
||||
Debug.Log(Vector3.Dot(groundHit.normal, transform.up) );
|
||||
mSM.CancelMomentum();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user