I’m using three raycasts to find the edge directly in front of my characterController capsule and store the normal:

```
void Update()
{
forwardRay = transform.position + transform.forward * 0.4f;
RaycastHit hitInfo = default(RaycastHit);
var raycast = Physics.Raycast(forwardRay, Vector3.down, out hitInfo, Mathf.Infinity, 1);
if (raycast)
{
edgeVector = Vector3.zero;
}
else
{
RaycastHit hitInfo1 = default(RaycastHit);
var raycast1 = Physics.Raycast(transform.position, Vector3.down, out hitInfo1, Mathf.Infinity, 1);
if (raycast1)
{
ground = hitInfo1.point;
RaycastHit hitInfo1 = default(RaycastHit);
var raycast2 = Physics.Raycast(new Vector3(forwardRay.x, ground.y + -0.02f, forwardRay.z), new Vector3((-transform.forward).x, Of, (-transform.forward).z), out hitInfol, Mathf.Infinity, 1);
if (raycast2)
{
edgeVector = hitInfo2.normal;
}
}
}
}
}
```

I then use ProjectOnPlane to ensure the characterController slides along the edge instead of just stopping dead in it’s tracks:

```
GetComponent<CharacterController>().Move(Vector3.ProjectOnPlane(Quaternion.Euler(transform.eulerangles) * new Vector3(0f, gravity, currentSpeed), edgeVector) * Time.deltatime);
```

The trouble is, it doesn’t handle adjacent corners at all and just falls off, since the raycast is only finding the edge normal directly in front of the capsule. Here you can see the red ray is my forward vector in worldspace, and it fires back from there (pink ray) towards the height of the ground beneath my capsule (blue ray): Edgggg GIF by zebbidev | Gfycat

Is it possible to find the next normal in the direction I’m moving, or better yet, wrap the ProjectOnPLane vector around the nearest normal in it’s projected direction? Otherwise, I’m just doing this the wrong way?