Character Controller and Camera for Faux gravity..(Mario Galaxy)

So many people ask the question about Mario Galaxy, and I spend my spare time to create the same effects.I read their request and question, and I decide to use

transform.rotation = Quaternion.FromToRotation (Vector3.up, (transform.position - Vector3.zero).normalized); 

to rotate my character, and it works. But there is a problem, the collision capsule of Character Controller do not rotate, it makes a lot of trouble about collision, such as hit the barricade.

looks like this:

alt text

Secondly, about the camera, I want to put my camera in front of the character, even though the character have rotated. Does it have any function I can use??

Thanks for your help!!

If you need a variable gravity / up direction for your character, you need to use a Rigidbody with a Capsule Collider and not a CharacterController. Rotating CharacterControllers around anything other the Y axis just doesn't work, and rotating the entire world is very sub-optimal and error prone physics-wise.

The Locomotion System project has a demo scene with a character with variable up direction, so that's one example of how to do it.

Yes, the collider for the character controller does not rotate, which makes the character controller component less than suitable for this particular application.

If everything else is working more or less the way you want, the easiest solution (although not an ideal one) would probably be to adjust the capsule parameters to make it a sphere. Obviously a sphere is a poorer approximation of a typical humanoid shape than a capsule, but I imagine it could work, depending on the circumstances.

Instead or rotating the character which will cause the problems you describe. I'd rotate the universe around the character and then rotate the camera back the opposite way. This should have the same effect that you want but the characters feet will remain the bottom of the character controller.

If you parent everything in the 'universe' to an emtpy game object, then reverse what you want the characters angle to be, then reverse the cameras z rotation it should work... in theory... in my brain it does.