How to make a character controller slide down when the angle of a slope is over 45 degrees
Hi there,
I recently started working with Unity and I came across a problem with walking on objects with any slope angle. The problem is that my character controller can walk up to anything below 45 degrees, however although it cannot walk up anything above 45 degrees is can still walk forward.
After some googling I found a script called FPSWalkerEnhanced, however it doesn't seem to work in Unity 5 (I read this in a Youtube comment). I was wondering if anyone found a solution for this?
This is my code for moving around:
using UnityEngine;
using System.Collections;
public class ThirdPersonController : MonoBehaviour
{
static public float movementSpeed = 5.0f;
public float turnSensitivity = 2.0f;
// Use this for initialization
void Start ()
{
//Screen.lockCursor = true;
}
// Update is called once per frame
void Update ()
{
//rotation
float rotLeftRight = Input.GetAxis ("Horizontal") * turnSensitivity;
transform.Rotate (0, rotLeftRight, 0);
//movement
float forwardSpeed = Input.GetAxis ("Vertical") * movementSpeed;
Vector3 speed = new Vector3 (0, 0, forwardSpeed);
speed = transform.rotation * speed;
CharacterController cc = GetComponent<CharacterController> ();
cc.SimpleMove (speed);
}
}
Thanks in advance,
Nikki
Answer by Paul_Hughes · Nov 24, 2021 at 12:59 AM
I really would like a solution for this for the starter assets ThirdPersonController to slide at these angles, I've tried so many solutions but to no avail, been weeks now and starting to get to me.