I have build a leaning function for my FPS character.
to prevent him to look through walls I added 2 CapsuleCollider with rigidbodys around the camera.
the outer Capsule stops the leaning so the camera cannot go farther on. the inner Capsule should move the camera a bit back to the center if I walk into a wall.
so now my problem is if I push the “lean right” button and it detects a wall it will stop move. thats good. but when I let the button go and push at the same time the “lean left” button it will still stop moving the camera because I only have this one Collider…
same for the inner collider. I cannot determine if I hit a wall on the right side or on the left side…
as I wrote these lines I found a solution that could work but I still want to know if there is a simple line of code that I could add to my Colliders to determine which hemisphere is hit.