- Home /
How do I rotate a Collider?
I am making a third person game and I want to make the character go prone(lay down). How can I change the character controller collider to rotate so that it lies along the ground instead of up and down. Or if that is not possible or very complex how can I go about shutting off one collider and turning on another? Which way is better use one collider and rotate it so it lies on the ground or use two colliders one for stand/crouch and another for prone. I can not seem to find any ways to rotate the collider without rotating my mesh.
Answer by aldonaletto · Nov 22, 2012 at 01:11 AM
The CharacterController is always upright: its vertical direction is always world Y, even if you rotate the transform.
If you want a soldier or similar character, a possible solution is to change the CharacterController height - and perhaps its radius when the character goes prone (a height < 2 * radius is ignored and assumed to be twice the radius). For instance: h=1.8 r=0.4 for stand, h=1.4 r=0.4 for crouch, h=0.4 r=0.2 for prone. The problem here, obviously, is the horizontal dimension, but in many cases only the height matters (to be hit by enemy shots). If you want to make the soldier vulnerable to hits when in prone position, add a box collider (menu Component/Physics/Box Collider - select Add instead of Replace when the Replace existing component dialog appears). Adjust the box collider center and dimensions so that it never touches the CharacterController capsule, or the character will "think" it's colliding with its own colliders.
Answer by SomeGuy22 · Nov 22, 2012 at 12:41 AM
You can't rotate the character controller but you can shrink it to be the approximate size you want. Take a look here, same idea: http://answers.unity3d.com/questions/21811/how-to-make-the-fps-character-crouch.html
I know I can shrink the controller and that does help with crouch, which I do have
working well enough, but I need to be able to detect collisions with the front of the body and the legs. The capsule collider doesn't stretch into an oval. For example the collider stands up and down along the y axis and I need it to go left and right along the x or z axis. So when I shrink the capsule down to the height it needs to be in the y direction it eventually becomes a sphere and it will not stretch beyond a perfect sphere. But I need the capsule to encompass more of the body then just the middle section. I hope this helps clear up what I need.
Answer by giantkilleroverunity3d · Jan 10, 2017 at 08:22 AM
Post friggin toasty. Add a rigidbody and then manipulate. The addition of a collider needs to know the spatial orientation. At least this is why the inteface works the way it does. Without the RB the rotational manipulation does not enable a rotation of the vector handles.
Your answer
![](https://koobas.hobune.stream/wayback/20220613084311im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Images Rotation 1 Answer
Rotate the wheel collider when car flip 1 Answer
Click on collider to rotate camera 1 Answer
Mirroring sprite around arbitrary axis causes collision issues 0 Answers
Compound Collider Moving Parts? 4 Answers