I've created a CharacterController class and assigned it to a camera.
Unfortunately the controller entity will stick to triangular walls if the camera is in mid air so the camera no longer rises or falls depending on the current velocity of the jump cycle.
Also, the camera velocity isn't preserved in the direction of the movement when the entity is controller entity is touching a wall. In other words a sliding response is slower than it should be as if the friction of the wall was very high.
What might be the cause?
CharacterController class entity sticks to walls.
-
- Posts: 249
- Joined: Wed Nov 17, 2010 1:49 pm
Re: CharacterController class entity sticks to walls.
My first guess with the sticking is mesh edge detection again. In some situations, the convex cast that the CharacterController uses can find such edges. If the CharacterController shows that it is supported while sitting on a mesh edge, this is very likely what is happening. The SimpleCharacterController does not suffer from this problem since its support and stepping is just a ray pointing out the bottom center of a capsule.
The character controller has to be rewritten to take full advantage of v0.15.0's new features anyway, so an improved version is on the to-do list.
The character controller has to be rewritten to take full advantage of v0.15.0's new features anyway, so an improved version is on the to-do list.
Is the friction high? By default, the character's friction isn't zero. The expected result is some sliding resistance. You can change the friction of the body as well as the blending mode (space.SimulationSettings.CollisionDetection.FrictionBlender/FrictionBlendingMode) to address this. You can also avoid changing the blending mode by overriding the friction calculation for a specific collision pair by adding an event handler. Here's an example you can put in the CharacterController constructor:In other words a sliding response is slower than it should be as if the friction of the wall was very high.
Code: Select all
Body.EventManager.CreatingCollisionPair += delegate(Entity a, Entity b, CollisionPair pair)
{
pair.DynamicFriction = 0;
pair.StaticFriction = 0;
};