Add climbing to Unity Standard Assets 3rd person controller?
I'm prototyping a project using the standard assets Ethan controller right now and I want to add climbing. Currently, I'm using the following script:
 public class ClimbableSurface : MonoBehaviour
 {
     public GameObject player;
     public bool canClimb = false;
     float speed = 5;
     void OnTriggerEnter(Collider other)
     {
         if (other.gameObject == player)
         {
             canClimb = true;
             player.GetComponent<Rigidbody>().useGravity = false;
         }
     }
     void OnTriggerExit(Collider other)
     {
         if (other.gameObject == player)
         {
             canClimb = false;
             player.GetComponent<Rigidbody>().useGravity = true;
         }
     }
     void Update()
     {
         if (canClimb == true)
         {
             if (Input.GetKey(KeyCode.E))
             {
                 player.transform.Translate(Vector3.up * Time.deltaTime * speed);
             }
             if (Input.GetKey(KeyCode.R))
             {
                 player.transform.Translate(Vector3.down * Time.deltaTime * speed);
             }
         }
     }
 }
I have successfully invoked the class (public ClimbableSurface cS;) within the ThirdPersonCharacter script and the buttons that I've assigned to climbing up/down work, but it's more like a jump right now. What I believe is happening is that the player starts climbing and then registers as airborne, so then the ThirdPersonCharacter script treats it like a jump and forces the character back down to the ground. Is there a way to make the TPC script ignore raycasting while cS.canClimb == true? Or does anyone have other ideas for successful addition of climbing to this controller?
Your answer
 
 
             Follow this Question
Related Questions
Need Help with my climbing system 0 Answers
LayerMask Not working when raycasting to Specific layer. 0 Answers
How to use fps hands and third person character together in multiplayer project 0 Answers
RayCast not accurate on non-colliders (3D) 1 Answer
How do I get a character to dig underground to another location and vice versa? 0 Answers
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                