Simply put, every time I apply a Character controller to an object, it falls through the floor. I'm working on some scripts right now and I'm using basic primitives (spheres and cubes) as the characters in the game. Every time I apply the controller to the character, he falls through any object I put below him.
In previous versions of unity, this wasn't a problem. But now when the Rigid Body and Controller are in place there seems to be no collision. The objects that make up the floor are set as collider, trigger is not checked.
If I also apply a collider (cube or sphere) to the character, it sits fine on the floor, but then the controller can't seem to recognize commands or states (i.e. grounded).
Any help would be fantastic!
Edit: It may also be important to note that the character controller reacts the same way with or without any scripting on.
Answer by ZenithCode
Dec 17, 2012 at 11:09 PM
Add a rigidbody on the floor plane as well and character will not fall through.
This did not work.
Do you have a collider on the plane? If yes, try replacing the plane with a stretched cube and repeat the above.
The current floor is a stretched cube. I have also tried it with a terrain and a plane. All of which had colliders.
Move the character controller's object higher above the ground object. sometimes it takes a second for unity to realize collisions at start of game (due to object initialization) and therefore having a character controller too close to the ground can cause it to fall and not register the collider on the ground. make it about 4 or 5 units above the ground (4 or 5 above the character controller not touching the ground). Tis should work. I had a similar problem and this seemed to solve it. An ordering of scripts or such in the execution order pane might solve this but I am unsure.
Answer by blumenkohlfrau
May 09, 2013 at 07:44 PM
Make sure that in the field under your terrain collider where it asks for "terrain data" that you have selected your terrain (when you click on the little circle, the box will pop up and you can choose your terrain; it defaults as "New Terrain")
Answer by EmJay
May 09, 2013 at 11:20 PM
In Unity 3.0 you can't use character controller and rigidbody with a single gameObject. You need to write your own gravity scripts in order to simulate gravity's effect. And don't use transform.Translate since it skips all collider checks.
You move objects with rigidbody by addForce() function and objects with character controller you move with SimpleMove() or Move(). These translate functions do have collider checks when you use them.
Also remember to check if all the objects have colliders.
Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.
The best place to ask and answer questions about development with Unity.
To help users navigate the site we have posted a user guide.
If you are a new user, check out our FAQ for more information.
If you are a moderator, see our Moderator Guidelines page.
We are making improvements to UA, see the list of changes.
For troubleshooting common problems with Unity 5.x Editor (including Win 10).
Answers and Comments
13 People are following this question.
Collision normal angles.
Character Collider doesn't collide with other Colliders
Charcontroller doesnt collide when not moving
add camera collision without CharacterController
How to detect angles of walls?