How to force rotate top down character to movement direction even when colliding with something

I have top down character setup with look in move direction as the following.

It works great except when there is a wall or another collider in the back of the character and the character tries to move toward the wall.
Once the character collides with the wall it doesn't rotate towards it.
I want it to rotate and look at the wall even if it can't pass through, how can I achieve that?

As you can see in the following video I am trying to move toward the collider. The player starts rotating but as soon as it touches the wall it stops rotating and doesn't look in the direction of the controller.

Even if there is no built in way to do it, please guide me to where in the code can I try to modify to achieve that.
It's important for the project.


Staff member
This is likely due to the collider intersecting with the wall's collider, preventing the rotation from being applied. Could you try debugging this by logging CharacterLocomotion.ApplyRotation to see if the rotation is actually being applied? You can then go back up the stack from there to see where the rotation is being prevented.
Hi @Andrew

Thank you for pointing me to the right direction.
The main problem is that the main capsule collider is not 100% aligned with the pivot of the character which will cause intersection between the character collider and the wall if the character rotates.
I fixed that by creating a parent object above the character and make sure the collider is aligned with the pivot of that parent object.
And moved the child character to align with the new collider position


Staff member
Glad you got it sorted. Although there is a CapsuleColliderPositioner component which handles the positioning of the character's CapsuleCollider, which may be able to produce the same results.