Problem with character controller and gravity in multiple directions

Hi
Im finishing up my playermovement in my unity project but I have encountered a problem. I have implemented gravity that works in all directions (using a vector3 rather than a float) and a function that lerps the player´s rotation to align with the gravity axis. This resulted in strange behavour. After some debugging last night I found that the charactercontroller, which my scripts depend on, doesn´t rotate with my player gameobject.

Is there a way to rotate the charactercontroller? I read somewhere that a character controller always is oriented after the y axis? Can you change that or is there another way to solve my problem?
Adrian

No, there is no way to rotate the character controller, sorry.

The only solution we found - because we built a game you can walk on the ceiling - was to not use the character controller, and use a rigid body instead.

Yes, it’s an impressive pain to recode its behaviour for our needs.

IIRC the Unity CharacterController is a (sort-of) carbon copy of the PhysX CharacterController. After some searching i found a resource on this:

source: https://developer.nvidia.com/sites/default/files/akamai/physx/Docs/CharacterControllers.html

Have to double what Lightstriker just said.

We used a rigidbody as well.

And it was annoying to code up, but we go it.

dterbeest is right, the CharacterController is just a wrapper around the PhysX CharacterController. And it only supports y-axis as up.

To get the rigidbody working I created my own controller class that allowed for various modes using either CharacterController OR rigidbody (rigidbody having 2 modes), as well as any custom modes you may want. This allows for a consistent interface no matter the mode used.

I was going to also write another mode that used neither, and only a Collider instead, and do all the movement manually. Basically acting like a CharacterController, but with full freedom of axis. But I never got around to finishing it and testing it, and our current project has no need for it.

I think im to lazy to switch to a rigidbody because my whole movement script is depend on the charactercontroller (but next time ill try to use a rigidbody instead). Wouldnt a quick fix be to rotate the the parent of all objects in the map around the player(using player position as rotate around point)? Wouldnt that give the exact same result? Is there a better way to achieve this
Unity - Scripting API: Transform.RotateAround

Sure… if you want to kill your performance.

The maps are really simple and I never get above 50draw calls but I undestand your point =)

I would also like to point out that it makes the entire thing 1 player and all physics relative to said player. Which is fine if that’s what you want.

I know with the game I was working on, that wasn’t an option. Mobs and the sort had to have gravity relative to their location too.