Humanoidless top down action character

Hey developers, so recently, I’ve been trying to make an humanoidless anchored character that moves around with velocity. I’m doing this to be able to extrapolate the character for anti-exploit needs and to be able to control freely the entities replication.

I’ve already been able to make the character move around, but I’m having trouble finding a good way to apply collision to the character. My character has a cylinder as collision so I tried using rays first and found a method to negate the normal of the colliding wall to the character’s velocity (dot product). But the problem is that the character can enter slightly the wall, meaning it stuck itself in the wall at one point and make the character go in an unwanted direction.

on this gif, I’m only trying to go down
https://cdn.discordapp.com/attachments/715887351091560478/803334291672924190/hMPzooLvln.gif

So here my question: Is there any better method to handle custom collision for this kind of system?

If you don’t want the character to “slip” around walls like that, don’t apply sideways force when they’re trying to go down. And that generalizes to don’t apply force that’s perpendicular to the desired walk direction.

So you need to subtract the sideways wall force from the total wall force to get the parallel wall force. Which in this case is the same as projecting the total wall force onto the desired walk force. Here’s an illustration

The orange arrow is the walk force, the green is the total wall force, and the red is the parallel walk force, which you should actually apply. It’s easier to see that it’s the green arrow projected onto the orange arrow.

Here’s a formula for projecting vector v onto vector u

image

Taken from Welcome to CK-12 Foundation | CK-12 Foundation

Keep in mind that the “multiplication” here is dot product.