|
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
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:
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!!
(comments are locked)
|
|
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. Thanks Rune Skovbo Johansen, I will download that project to figure out how to make it.. I am very appreciated..
Jan 26 '11 at 10:40 PM
Lucas
(comments are locked)
|
|
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. Ha, my friend tell that few days ago, but I hope I can find "precisely" solution for it. and I believe the collide would more accurate. How about the camera one? can you give me some advices?
Jan 26 '11 at 06:37 AM
Lucas
Adjusting the CharacterController height to be a sphere won't work correctly. The CharacterController handles ground and walls differently. No matter if the shape is a sphere, settings like Slope Limit and Step Offset still assumes that Y is up.
Jan 26 '11 at 09:59 AM
runevision ♦♦
(comments are locked)
|
|
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. Not sure about that; transforming the world to give the effect of a camera transformation is rarely the optimal solution. Also, although it might work, I imagine constantly rotating/moving every collider in the simulation other than the character controller would be a bit of a stress test for the physics engine. (Rotations are typically more difficult to handle as far as collision detection goes than linear motion against static objects.)
Jan 26 '11 at 07:59 AM
Jesse Anders
Jesse's right; and especially moving static colliders is rather a no-no if you want performance.
Jan 26 '11 at 10:30 AM
Eric5h5
So, do you have any good solution have good performance and same effect? I try it if I fix the character's position, there are no collision happened(the barricade is trigger), that's why I make the surface ball fixed, and character walk on the ball surface. Maybe I should try to fix the character and camera, when I press forward, just set surface ball rotate faster... does it works?
Jan 26 '11 at 10:37 PM
Lucas
(comments are locked)
|

