So I’m trying to find a way to stop my character from going through walls, but here is the catch, without using rigidbodies.
So far I can use rayCasting in 8 directions (as the collider is a capsule I need at least 8 rays to go in the main directions) but I find this limited as future non-square colliders on the objects may cause problems with my actual code (which is far from perfect) that finds the point of impact of the ray and stops the character from going over that coordinate.
I tried to use spherecast at direction Vector3.zero and distance 0 (to make it stay around my character) but it doesn’t work.
Thought of using CheckSphere or OverlapSphere but it doesn’t return the point of impact (as far as I know).
Is there another option? I don’t like the in-built physics calculations as in the past I found ways to cheat them and so I don’t trust them very much. Example: used to put invisible walls around my map to keep the character in the interested area, but under certain conditions I was able to pas them. The I started using Mathf.Clamp on transform.position and never had a problem since then.
Any suggestion is welcomed.