For my game I'm quite satisfied with ork's default player controller and I'm ok with Unity's character controller. My only problem is I have a few characters for which the y-axis oriented capsule collider from Unity's CC can't be used.
I didn't want to create a new character controller from scratch, as I was fine with what I had, I just wanted to have the option to edit the collider shape or, alternatively, to add another collider to my mesh. So I wrote a little script to manage kinematic collisions in case of another collider attached to a game object with a character controller. This is definitely a dirty solution, but it's also quick and easy, so I figured I'd try to manage to see it through.
This is the result:https://dropbox.com/s/8nlpvsmarry3qh7/Screenshot%202017-09-05%2019.52.38.png?dl=0
I have a game object with a character controller, a capsule collider + kinematic rigidbody (obviously with a different shape from the one in the character controller), my collision manager and a simple movement script. This works the way I want it to (with a few tweaks to do, of course). The same setup doesn't work if I recreate it on a character with the default player controller script in place of my simple movement script (I guess that's to be expected) running in game. What happens is the second collider doesn't seem to push back the player object while moving inside obstacles, but if I stop the player with the second collider penetrating an object, it gradually moves outside:
Before penetration:https://www.dropbox.com/s/ap3wyevmkdfzjb3/Screenshot 2017-09-05 20.24.18.png?dl=0
During penetration (key pressed and movement happening). The character isn't selected to better show the debug points marked by the crosses (capsule collider calculated point 1, point 2 and center. These are the CALCULATED points, where the collider is supposed to be, but the actual collider is penetrating the object):https://www.dropbox.com/s/5nixd8idfe7gei0/Screenshot 2017-09-05 20.24.33.png?dl=0
Key released and movement stopped:https://www.dropbox.com/s/729vhk9omevgq8e/Screenshot 2017-09-05 20.24.39.png?dl=0
I guess my question would be.. can this be done? Or should I discard this approach and write my own player controller?
A few info on my collision manager script:
1) everything (collision check, pushback calculation and resolution) happens in a FixedUpdate();
2) the collision is detected through CapsuleOverlap and the colliders are fed to the relatively new Physics.ComputePenetration method
3) the pushback happens through the gameobject's transform.Translate()
Thanks for you help!