Hello people at Unity forums. I appreciate the time taken to read and answer this.
I’m not using Unity’s character controller. I’m rolling up my own character because I want it to have physics. I later on explain this decision. I’m doing a minecraft clone and I have this problem:
If I create a plain floor made of 50x50 consecutive cubes, when I apply a force in a direction to the character to move it (which is on top of that floor), it moves, but sometimes the character comes to a full stop and I can’t move it in that direction anymore. I can though go in the opposite direction and again try to go through the part I get stuck and most of the times it does get through, so this feels pretty random.
The exact setup for my character is this: Character is a game object parent. It has a rigid body attached with default settings (including gravity turned on). It has as a child, the CubeCollider game object, which has a BoxCollider component attached in the form of a (1,1,1) box. The rotation of the Character is fixed in every dimension. And the cubes that compose the floor are just Unity’s Physics → Cube.
I wonder if this whole setup is a bad idea or if only a part of it is.
I don’t want to use Unity’s Character Controller because the shape is a capsule. I don’t want that because of this
.
That is not how minecraft behaves. There’s no sinking at borders.
They don’t tip over. They just sink as shown in the video. This makes sense because the character is a capsule.
Because of that, I don’t want it to be a capsule. I want it to behave as a box. If all I’m doing is dragging a box on top of consecutive boxes, then why does it get jammed?
I ran into a situation similar to this. What I ended up doing was creating a custom mesh collider in the shape of a capsule with a almost completely flat bottom. It was slightly curved so that it can still go over small edges on the floor.
The problem was, even with this, friction was causing issues. As a result, I ended up putting a physics material with all values to 0 and friction / bounce set to minimum on my collider.
This basically means that physics material will no longer affect my character and I will have to handle that on my own with custom friction components, however, I saw it as a good trade off.