Some good news and some bad news:
I have what appears to be a solution for the problems you were observing with the SimpleCharacterController, and fortunately, it's pretty easy:
1) StaticTriangleGroups/Terrains have a "tryToUseTriangleNormals" boolean in them that, if enabled (and it is enabled, by default), will use the triangle's normal in any collision whose normal is less than "useFaceNormalWithinAngle" radians away from the triangle normal. This helps smooth sliding motion across triangle boundaries generally. However, at sharp angles, the collision normals returned can be 'too' wrong. Specifically, when the character capsule falls off the side of a railing, a contact whose normal is completely vertical (matching the upper triangle's normal) may be created. The collision response system removes all velocity along that normal, stopping the capsule from falling further.
Since the character's raycast doesn't hit anything, you aren't able to do anything in this position and you get 'stuck.' You can either the StaticTriangleGroup's tryToUseTriangleNormals field to false, or reduce the useFaceNormalWithinAngle angle.
2) Once you have correct normals, friction may still stop the character from sliding off. You could set the friction of your entire group and character to 0 to solve this, though there is a better approach. Attach an event to the character's body cylinder of the "controller created" type. Set the new controller's friction to 0. This overrides the character's previously computed friction and lets the capsule slide off easily. Here's some sample code to do this.
Code: Select all
//The event handling method...
public void controllerCreated(Entity e, Controller newController)
{
newController.dynamicFriction = 0;
newController.staticFriction = 0;
}
//Call this from the character controller constructor to hook the event
body.addEventHook(new EventHandlerControllerCreated(controllerCreated));
The bad news is that I just discovered an annoying flaw with the latest version of the character controller I've been working on. It's going to require some significant work to get around, and it will probably need to wait until v0.10.0 is done.
On an unrelated note, if you needed better physics behavior other than your characters, it may be a good idea to shrink the world some more. I noticed when creating the boxes that they bounced and intersected the environment oddly. If the world was around 1/30th to 1/70th the size, most of these problems would disappear.