The player is mounted rigidbody. When climbing a steep slope, everything works as it should: the player cannot climb at a certain angle of the slope. But, if during the ascent you also jump (jumps with the help of addforce), then you can easily climb a steep hill. How can this be fixed?

public float jumpForce; Rigidbody rb; void Start(){ rb = GetComponent<Rigidbody>(); } void Update() { Ray ray = new Ray(transform.position + transform.up, -transform.up); if (Physics.Raycast(ray, 1.1f)) { if (Input.GetKeyDown(KeyCode.Space)) { rb.AddForce(Vector3.up * jumpForce); } } } 
  • Give the full code of the jump, addforce can be used very differently. - RiotBr3aker
  • @ RiotBr3aker public float jumpForce; RaycastHit info; Rigidbody rb; void Update () {Ray ray = new Ray (transform.position + transform.up, -transform.up); if (Physics.Raycast (ray, 1.1f)) {if (Input.GetKeyDown (KeyCode.Space)) {rb.AddForce (Vector3.up * jumpForce); }}} - Anton Tereshkin
  • @RiotBr3aker Sorry, that all in one line. I am just starting to use the site and do not know how to publish the code here - Anton Tereshkin
  • It is better to add this information to the question itself, rather than write in the comments :) - RiotBr3aker
  • Do you have a check whether the character is on the ground or not? - RiotBr3aker

0