Download

Increasing Capsule Collider Radius Clips Through Static Geometry

So my problem is that I am trying to change the size of my capsule collider on my character, and if I change the size next to something static like a wall then my character’s collider will be sticking into the wall instead of pushing itself back from the wall. Here is a crappy ms paint sketch of the situation:

f3d68ec934da066fb819bd8e15a037b79a3dd77e.png

What I really want is for the capsule to automatically move itself out of the wall when this happens (see the desired result). Is there maybe some kind of outward-expanding collision sweep I haven’t found that can detect the wall as the collider changes sizes? Or maybe there is some other easier way of accomplishing this. The main problem is I want this to happen in a single frame, so I can’t spend a whole bunch of frames “growing” the capsule radius. Additionally, it is important that the solution somehow moves the capsule back while expanding, or moves it back before expanding because increasing the size in one frame next to physics objects sends them flying off at ridiculous velocities (essentially I want the capsule to push itself back not push other things forward). I’m not much of a 3D math person so I’ve been totally stumped on this one for a couple days.

Thanks for the help!

Does anybody have any ideas I can try out?