Character Controller Friction?

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
matt33315
Posts: 4
Joined: Wed Jan 02, 2013 12:42 am

Character Controller Friction?

Post by matt33315 »

Is there a way I can make the character controller take into account friction when moving?
I have the floor friction set really high and I am using the Move(vector 2 direction) method to move the controller but it makes my character move in that direction forever.
I would be really nice If there was a way I could call move on the controller and then have it slow down over time.

Is there a way to do this?

Thanks
Matt
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Character Controller Friction?

Post by Norbo »

It sounds like you're using a wrapper of BEPUphysics which I am not familiar with, so I can't tell you exactly how to do it on that level.

Here's how you'd do it with the the original character implementation:
The character is not aware of materials. In fact, it explicitly ignores all material interactions between the physical entity of the character and its support. This allows the HorizontalMotionConstraint associated with the character to act without opposition. It would be relatively easy to take friction into account for the motion constraint. The most obvious approach would be to scale the force properties of the HorizontalMotionConstraint according to the friction coefficient.

However, it sounds like the "Move" method is setting the movement direction of the character controller. If that's true, then even if friction affected the character's movement, it would still keep moving. It will keep trying to move until it's told to stop. In other words, the character isn't sliding, it's walking.

If you want it to gradually stop walking regardless of friction, you could gradually scale down the speeds of the character. The latest development version adds in a SpeedScale property on the HorizontalMotionConstraint which makes this more convenient.
Post Reply