|| Introduction to the problem
Hi and welcome, I should preface this by saying that the mathematics going into this post has been simplified for easy understanding and proving formulae and theory is not going to be talked over.
Welcome to another post, I’ve been meaning to talk about this for a while but havn’t had the time to write it down. Along the development process of my game (Primal Dominion: Aftermath), I found myself questioning whether or not it was a feasible idea to incorporate procedural animations based on obstacles and structures in close proximity to the player. I devised a simple function that would do a sphere cast and I would determine an avoidance angle which would drive the upper body of the character away from the wall.

I generally wasn’t too sold on this idea as I felt like it was counter intuitive when playing, it gave the illusion of the dinosaur moving away and thus I would be convinced I am moving away and would end up colliding with walls thinking I would be safe. This insipired to me to rethink the system and incorporate it into a much more meaningful feature.